diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 6b5c87b5c3..ea3123735f 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -469,6 +469,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', @@ -674,6 +677,8 @@ def parse_args_and_make_package(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 63ba86258f..720fcb29c1 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -32,6 +32,7 @@ android { targetSdkVersion {{ android_api }} versionCode {{ args.numeric_version }} versionName '{{ args.version }}' + multiDexEnabled true } {% if debug_build -%} @@ -98,4 +99,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 a37e720753..91c988b1d0 100644 --- a/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml @@ -132,6 +132,18 @@ {% for a in args.add_activity %} {% endfor %} + + {% if args.fileprovider_paths %} + + + + {% endif %} diff --git a/pythonforandroid/bootstraps/webview/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/webview/build/templates/AndroidManifest.tmpl.xml index d71985c66e..7e1123802f 100644 --- a/pythonforandroid/bootstraps/webview/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/webview/build/templates/AndroidManifest.tmpl.xml @@ -49,7 +49,8 @@ android:icon="@drawable/icon" android:allowBackup="true" android:theme="{{args.android_apptheme}}{% if not args.window %}.Fullscreen{% endif %}" - android:hardwareAccelerated="true" > + android:hardwareAccelerated="true" + android:usesCleartextTraffic="true" > {% for l in args.android_used_libs %} {% endfor %} @@ -92,6 +93,19 @@ {% endif %} + + {% if args.fileprovider_paths %} + + + + {% endif %} + diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index 402ddaada4..787cf00691 100644 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -955,7 +955,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('=')