File tree Expand file tree Collapse file tree
pythonforandroid/bootstraps/common/build Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ options (this list may not be exhaustive):
9292 run. See :ref:`arbitrary_scripts_services`.
9393- ``--add-source``: Add a source directory to the app's Java code.
9494- ``--no-compile-pyo``: Do not optimise .py files to .pyo.
95+ - ``--enable-androidx``: Enable AndroidX support library.
9596
9697
9798webview
Original file line number Diff line number Diff line change @@ -343,6 +343,9 @@ def make_package(args):
343343 join(res_dir, 'drawable/icon.png')
344344 )
345345
346+ if args.enable_androidx:
347+ shutil.copy('templates/gradle.properties', 'gradle.properties')
348+
346349 if get_bootstrap_name() != "service_only":
347350 lottie_splashscreen = join(res_dir, 'raw/splashscreen.json')
348351 if args.presplash_lottie:
@@ -706,6 +709,10 @@ def parse_args_and_make_package(args=None):
706709 'topics/manifest/'
707710 'activity-element.html'))
708711
712+ ap.add_argument('--enable-androidx', dest='enable_androidx',
713+ action='store_true',
714+ help=('Enable the AndroidX support library, '
715+ 'requires api = 28 or greater'))
709716 ap.add_argument('--android-entrypoint', dest='android_entrypoint',
710717 default=DEFAULT_PYTHON_ACTIVITY_JAVA_CLASS,
711718 help='Defines which java class will be used for startup, usually a subclass of PythonActivity')
Original file line number Diff line number Diff line change @@ -76,8 +76,13 @@ android {
7676 }
7777
7878 compileOptions {
79+ {% if args. enable_androidx % }
80+ sourceCompatibility JavaVersion . VERSION_1_8
81+ targetCompatibility JavaVersion . VERSION_1_8
82+ {% else % }
7983 sourceCompatibility JavaVersion . VERSION_1_7
8084 targetCompatibility JavaVersion . VERSION_1_7
85+ {% endif % }
8186 {%- for option in args. compile_options % }
8287 {{option}}
8388 {%- endfor % }
Original file line number Diff line number Diff line change 1+ android.useAndroidX =true
2+ android.enableJetifier =true
You can’t perform that action at this time.
0 commit comments