AndroidX Behavioral Changes
AndroidX is the enhanced version of the Android Support Library. Android Pie is the final release for android.support
;
all new feature releases will be available in androidx-packaged
.
In this document, we will explain about Quantum Visualizer's AndroidX-supported plugins and the Jetifier flags that are automatically added in the gradle.properties
file. Furthermore, we will discuss about the various issues that arise while you try to migrate your project to AndroidX and how to resolve these issues.
This document contains the following sections:
- Automatic addition of Jetifier flags in the
gradle.properties
file - Issues while migrating to AndroidX and their resolutions
- Convert
android.support
references by using Jetifier tool
Automatic Addition of Jetifier Flags in gradle.properties
File
From V8 SP4 Fixpack 47, Quantum has released AndroidX-supported plugins. As part of these plugins, the following Jetifier flags are specified in the gradle.properties
file:
android.useAndroidX=true
: The Android plugin uses the appropriate AndroidX library, instead of using a Support Library.-
android.enableJetifier=true
: The Android plugin automatically migrates existing third-party libraries (such as, JAR and AAR) to use AndroidX by rewriting their binaries.
IMPORTANT: After both these flags have been set, if the native Android project contains any references to the Android Support Library in its sources files and manifest entries, the command-line build will fail due to an Android Tools issue.
NOTE: With Android Studio 3.2 and later, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar. This action converts all android.support
references to androidx
. For more information about how to migrate an existing project to AndroidX, click here.
Issues while Migrating to AndroidX and their Resolutions
While consuming Quantum's AndroidX-supported plugins and migrating your project to AndroidX, you must manually replace any android.support
references in the following scenarios:
-
The plugins of a Cordova project or a React Native project that use
android.support
libraries.
Resolution: In this scenario, you can use the following Cordova and ReactNative project folders and click the Migrate to AndroidX option in Android Studio to convert allandroid.support
references toandroidx
:- Cordova: Quantum has provided you the control of the cordova
android
build folder (which gets generated during build time) to make the necessary changes. You can manually customize the Cordova-generated Android project, bundle this customized project, and then check in the modified cordovaandroid
build folder. For more information about the details of this resolution, click here. - ReactNative: Because you already have control of the react-native
android
project folder, you can directly integrate the AndroidX-migrated project. This folder gets integrated into the Quantum Visualizer project as a library project during build time.
- Cordova: Quantum has provided you the control of the cordova
-
For
android.support
references in NFIs and Android manifest tag entries added through Quantum Visualizer.
Resolution: You must manually change allandroid.support
references, and then build the application again. For more information about how to convertandroid.support
references by using the Jetifier tool, click here. For more information about the mapping of namespaces fromandroid.support
toandroidx
, click here.
Convert android.support
References by using Jetifier Tool
- Search the JavaScript files, Android Manifest tag entries, and XML files for the occurrence of the
android.support
string. - The Jetifier tool only accepts a .JAVA or .XML file as input. In accordance with this, copy all the
android.support
strings that you find to one file. For example,supportstrings.java
. - Click here to download the Jetifier zip file from the Install jetifier section, and then extract it.
NOTE: Your must install Java version 1.8 in your system to run the Jetifier standalone tool.
- Go to the extracted folder >
bin
folder, and then run the following command to getandroidx
equivalent references ofandroid.support
in the output file.
-i: The input file withandroid.support
references.
-o: The output file where the equivalentandroidx
references are to be saved.
jetifier-standalone -i <source-library> -o <output-library>
- You can now use the contents of the
androidxstrings.java
file to replace all theandroid.support
references.