From c38e73e04418dc46ca2f573c9a6d4d94c0f6f151 Mon Sep 17 00:00:00 2001 From: lmp Date: Tue, 15 Oct 2024 13:31:36 +0200 Subject: [PATCH] all: clean up and add docs --- README.md | 2 +- cli/cli.v | 1 + cli/options.v | 2 +- docs/FAQ.md | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1931c2b3..6cf558ac 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ You can build an Android app ready for the Play Store with the following command ```bash export KEYSTORE_PASSWORD="pass" export KEYSTORE_ALIAS_PASSWORD="word" -vab -prod --name "V App" --package-id "com.example.app.id" --icon /path/to/file.png --version-code --keystore /path/to/sign.keystore --keystore-alias "example" /path/to/v/source/file/or/dir +vab -prod --name "V App" --package-id "com.example.app.id" --icon-mipmaps --icon /path/to/file.png --version-code --keystore /path/to/sign.keystore --keystore-alias "example" /path/to/v/source/file/or/dir ``` Do not submit apps using default values. Please make sure to adhere to all [guidelines](https://developer.android.com/studio/publish) of the app store you're publishing to. diff --git a/cli/cli.v b/cli/cli.v index a930d2e6..1ab59c89 100644 --- a/cli/cli.v +++ b/cli/cli.v @@ -188,6 +188,7 @@ pub fn args_to_options(arguments []string, defaults Options) !(Options, &flag.Fl activity_name: fp.string('activity-name', 0, defaults.activity_name, 'The name of the main activity (e.g. "VActivity")') icon: fp.string('icon', 0, defaults.icon, 'App icon') + icon_mipmaps: fp.bool('icon-mipmaps', 0, defaults.icon_mipmaps, 'Generate App mipmap(-xxxhdpi etc.) icons from either `--icon` or, if exists, a .png in app skeleton "res/mipmap" directory') version_code: fp.int('version-code', 0, defaults.version_code, 'Build version code (android:versionCode)') // output: fp.string('output', `o`, defaults.output, 'Path to output (dir/file)') diff --git a/cli/options.v b/cli/options.v index 40d34318..c68dd916 100644 --- a/cli/options.v +++ b/cli/options.v @@ -64,7 +64,7 @@ pub mut: c_flags []string @[long: 'cflag'; short: c; xdoc: 'Additional flags for the C compiler'] v_flags []string @[long: 'flag'; short: f; xdoc: 'Additional flags for the V compiler'] lib_name string @[ignore] // Generated field depending on names in input/flags - icon_mipmaps bool @[xdoc: 'Generate App mipmap(-xxxhdpi etc.) icons from either `--icon` or, if exists app skeleton'] + icon_mipmaps bool @[xdoc: 'Generate App mipmap(-xxxhdpi etc.) icons from either `--icon` or, if exists, a .png in app skeleton "res/mipmap" directory'] assets_extra []string @[long: 'assets'; short: a; xdoc: 'Asset dir(s) to include in build'] libs_extra []string @[long: 'libs'; short: l; xdoc: 'Lib dir(s) to include in build'] version_code int @[xdoc: 'Build version code (android:versionCode)'] diff --git a/docs/FAQ.md b/docs/FAQ.md index 220aeaa0..c6c20bfa 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -1,6 +1,7 @@ # Freqently Asked Questions - [Where is the `examples` folder?](#where-is-the-examples-folder) +- [Generating `mipmap-xxxhdpi` icons in the APK/AAB](#generating-mipmap-xxxhdpi-icons-in-the-apkaab) - [`vab` can't find my device when deploying?](#vab-cant-find-my-device-when-deploying) - [The app force closes/crashes when I start it?](#the-app-force-closescrashes-when-i-start-it) - [`vab` can't find my SDK/NDK/JAVA_HOME?](#vab-cant-find-my-SDKNDKJAVA_HOME) @@ -25,6 +26,19 @@ Note that not all of V's examples have been written with Android in mind and may thus fail to compile or run properly, pull requests with Android fixes are welcome. +## Generating `mipmap-xxxhdpi` icons in the APK/AAB + +Yes. Pass `--icon-mipmaps` when building your application. + +The icon mipmaps will be generated based on the image passed via `--icon /path/to/icon.png`, +or if `--icon` is *not* passed (or invalid) `vab` will try and generate the mipmaps +based on what image that may reside in the "package base files" directory's "`res/mipmap"`. + +For a vanilla build of `vab` the mipmap icons will be generated based on: +`platforms/android/res/mipmap/icon.png` + +See [Package base files](https://github.com/vlang/vab/blob/master/docs/docs.md#package-base-files) for more info. + ## `vab` can't find my device when deploying? You [need to enable debugging](https://developer.android.com/studio/command-line/adb#Enabling) on your device.