diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 2b69082f14..6c9341c199 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -503,6 +503,9 @@ def make_package(args): remove('AndroidManifest.xml') shutil.copy(manifest_path, 'AndroidManifest.xml') + if args.fileprovider_paths: + shutil.copy(args.fileprovider_paths, join(res_dir, "xml/file_paths.xml")) + # gradle build templates render( 'build.tmpl.gradle', @@ -685,6 +688,8 @@ def parse_args(args=None): ap.add_argument('--depend', dest='depends', action='append', help=('Add a external dependency ' '(eg: com.android.support:appcompat-v7:19.0.1)')) + ap.add_argument('--fileprovider-paths', dest='fileprovider_paths', + help=('Add fileprovider paths xml file')) # The --sdk option has been removed, it is ignored in favour of # --android-api handled by toolchain.py ap.add_argument('--sdk', dest='sdk_version', default=-1, diff --git a/pythonforandroid/bootstraps/common/build/src/main/res/xml/.gitkeep b/pythonforandroid/bootstraps/common/build/src/main/res/xml/.gitkeep new file mode 100644 index 0000000000..8d1c8b69c3 --- /dev/null +++ b/pythonforandroid/bootstraps/common/build/src/main/res/xml/.gitkeep @@ -0,0 +1 @@ + diff --git a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle index 32bd091b72..e682e907c4 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -29,6 +29,7 @@ android { targetSdkVersion {{ android_api }} versionCode {{ args.numeric_version }} versionName '{{ args.version }}' + multiDexEnabled true } {% if args.sign -%} @@ -77,4 +78,6 @@ dependencies { compile '{{ depend }}' {%- endfor %} {%- endif %} + compile 'com.android.support:support-v4:26.1.0' + compile 'com.android.support:multidex:1.0.3' } diff --git a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml index 119a4daefd..e5fca5d17c 100644 --- a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml @@ -128,6 +128,18 @@ {% for a in args.add_activity %} {% endfor %} + + {% if args.fileprovider_paths %} + + + + {% endif %} diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index b61c9ac54a..7673e498fe 100644 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -916,7 +916,8 @@ def apk(self, args): # we can't leave it until later as the build.py scripts assume # they are in the current directory. fix_args = ('--dir', '--private', '--add-jar', '--add-source', - '--whitelist', '--blacklist', '--presplash', '--icon') + '--whitelist', '--blacklist', '--presplash', '--icon', + '--fileprovider-paths') unknown_args = args.unknown_args for i, arg in enumerate(unknown_args): argx = arg.split('=')