diff --git a/doc/source/buildoptions.rst b/doc/source/buildoptions.rst index dec55cddee..e1be899184 100644 --- a/doc/source/buildoptions.rst +++ b/doc/source/buildoptions.rst @@ -110,6 +110,9 @@ options (this list may not be exhaustive): - ``--enable-crashlytics-native-symbol-upload``: Enable processing and uploading of native symbols to Firebase servers. This flag must be enabled to see properly-symbolicated native stack traces in the Crashlytics dashboard. +- ``--res-values``: Resource value files to include in the app such as + ``colors.xml`` and ``styles.xml``. This option can be specified multiple + times. webview @@ -190,6 +193,9 @@ ready. - ``--enable-crashlytics-native-symbol-upload``: Enable processing and uploading of native symbols to Firebase servers. This flag must be enabled to see properly-symbolicated native stack traces in the Crashlytics dashboard. +- ``--res-values``: Resource value files to include in the app such as + ``colors.xml`` and ``styles.xml``. This option can be specified multiple + times. service_library @@ -220,6 +226,9 @@ systems and frameworks. project directory. - ``--add-gradle-plugin``: Add a plugin for gradle. The format of the option is ``:``. The option can be specified multiple times. +- ``--res-values``: Resource value files to include in the app such as + ``colors.xml`` and ``styles.xml``. This option can be specified multiple + times. Requirements blacklist (APK size optimization) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 1107cd000f..d665b748f4 100755 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -522,6 +522,13 @@ def make_package(args): xmlpath = join(args.private, xmlpath) shutil.copy(xmlpath, res_xml_dir) + # Copy res_values files to src/main/res/values + res_values_dir = join(res_dir, 'values') + if args.res_values: + ensure_dir(res_values_dir) + for xmlpath in args.res_values: + shutil.copy(xmlpath, res_values_dir) + # Render out android manifest: manifest_path = "src/main/AndroidManifest.xml" render_args = { @@ -832,6 +839,8 @@ def parse_args_and_make_package(args=None): 'directory')) ap.add_argument('--res_xml', dest='res_xmls', action='append', default=[], help='Add files to res/xml directory (for example device-filters)', nargs='+') + ap.add_argument('--res-values', dest='res_values', action='append', default=[], + help='Add files to res/values directory (for example styles.xml)') ap.add_argument('--with-billing', dest='billing_pubkey', help='If set, the billing service will be added (not implemented)') ap.add_argument('--add-source', dest='extra_source_dirs', action='append', diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index fe9d8ea3c5..360ab48620 100644 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -997,7 +997,7 @@ def _fix_args(args): fix_args = ('--dir', '--private', '--add-jar', '--add-source', '--whitelist', '--blacklist', '--presplash', '--icon', '--icon-bg', '--icon-fg', '--fileprovider-paths', - '--google-services-json') + '--google-services-json', '--res-values') unknown_args = args.unknown_args for asset in args.assets: