We have begun migrating all of the officially supported extensions to AndroidX. AndroidX is an improvement to the original Android Support Library, which is no longer maintained. All recent updates to Google Services such as Push, Games, Analytics and more are based on the AndroidX libraries. Facebook has also rolled out new versions of their SDK which only support AndroidX.
We will keep supporting the old versions of the extensions for as long as possible, but it is recommended that you migrate soon to not miss out on important bugfixes.
With this change it is extra important that you never depend directly on the master branch of any dependencies. You should always depend on a specific release to avoid breaking changes as the libraries get updated.
There should be no breaking changes. Android X libraries use new package names for all classes but should work the same as the old versions.
The problem is that you can’t mix old and new libraries, so either all of your dependencies need to migrate or none. We will handle migration of all our extensions, and we recommend or community to also migrate theirs.
It is usually just a matter of updating your dependency versions in build.gradle and then importing the AndroidX classes, like this:
In Defold 1.2.177 we will enabled support for the Android Jetifier tool to the Defold build servers to help with migration to AndroidX. The Jetifier tool is currently running on the beta server (https://build-stage.defold.com) and will be available on the main build server when 1.2.177 is released in about a week.
The Jetifier tool will automatically try to migrate dependencies defined in the build.gradle files of extensions and in .jar files in your project. The Jetifier tool is enabled as an application manifest setting for armv7 and arm64:
Does this mean that if one extension doesn’t use AndroidX, in my case I think GameAnalytics doesn’t, the game cannot use the latest IAP, Firebase, GPGS, Push and Facebook extensions?
Update: It seems not! Using the manifest generator with GameAnalytics + all the above mentioned dependencies built fine.
When you build with AndroidX/Jetifier enabled in the app manifest (we will make this a game.project option) gradle and the Android tools will try to migrate all gradle dependencies to AndroidX.
If GameAnalytics uses old support libraries or similar they will automatically become upgraded to their AndroidX equivalents when you build your project.
The problem is if your project contains Java code or .jar files which references old support support libraries in which case you need to manually migrate those or use the Android Jetifier tool to help with the migration.
What went wrong:
Execution failed for task ':downloadDependencies'.
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.appcompat:appcompat:1.1.0, androidx.core:core:1.1.0, androidx.versionedparcelable:versionedparcelable:1.1.0, androidx.fragment:fragment:1.1.0, androidx.lifecycle:lifecycle-common:2.1.0, androidx.appcompat:appcompat-resources:1.1.0, androidx.customview:customview:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.lifecycle:lifecycle-viewmodel:2.1.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.activity:activity:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.collection:collection:1.1.0, androidx.viewpager:viewpager:1.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.arch.core:core-common:2.1.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.vectordrawable:vectordrawable-animated:1.1.0, androidx.lifecycle:lifecycle-runtime:2.1.0, androidx.vectordrawable:vectordrawable:1.1.0, androidx.savedstate:savedstate:1.0.0, androidx.annotation:annotation:1.1.0