Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable androidx #2374

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ options (this list may not be exhaustive):
- ``add-source``: Add a source directory to the app's Java code.
- ``--compile-pyo``: Optimise .py files to .pyo.
- ``--resource``: A key=value pair to add in the string.xml resource file.
- ``--enable-androidx``: If the argument is included, the AndroidX support library is enabled.


Requirements blacklist (APK size optimization)
Expand Down
5 changes: 5 additions & 0 deletions pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@ def parse_args_and_make_package(args=None):
'topics/manifest/'
'activity-element.html'))

ap.add_argument('--enable-androidx', dest='enable_androidx',
action='store_true',
help=('Enable the AndroidX support library, '
'add a library using gradle_dependencies, '
'requires api = 28 or greater'))
ap.add_argument('--android-entrypoint', dest='android_entrypoint',
default='org.kivy.android.PythonActivity',
help='Defines which java class will be used for startup, usually a subclass of PythonActivity')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ android {
}
}

{% if args.enable_androidx %}
ext {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be preferable to put the if/endif inside the ext block (which would exist, but empty by default, and this way, more options could be added later in that block if needed?

Just a thought, it's certainly not a problem and it can be changed later when we actually have more options to put in there.

useAndroidX=true
enableJetifier=true
}
{% endif %}

}

dependencies {
Expand Down