Migration To Androidx
Well, I started a migration to AndroidX from a year old project (untouched since then) and I have problems withs the resources and the gradle build. Im completely lost with the new
Solution 1:
There is an error in your activity_principal.xml. Try to change:
android:style
to
style
Also you need to add
android.useAndroidX=true
to your gradle.properties file if you want to use androidX library instead of Support Library.
Solution 2:
In AndroidStudio 3.2+ you can use Refactor | Migrate to AndroidX to upgrade a project. For more go here.
Solution 3:
I spent an entire night trying to solve this issue after the migration to androidX. Below are the few things I did for it to work:
In gradle.property:
dex.force.jumbo=trueandroid.useAndroidX=trueandroid.enableJetifier=trueandroid.enableD8=trueandroid.enableR8.libraries = falseandroid.enableR8 = false
In build.gradle:
defaultConfig {
...
compileSdkVersion 28
…
}
//Use JDK1.8 and make sure the same is well specified in your gradle file.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
//Exclude Guava libraries
...
configurations {
...
implementation.exclude group: 'com.google.guava'
}
//Make sure your firebase and google libraries are all updated
...
implementation 'com.google.guava:guava:27.0.1-android'
...
After all these, few usual things:
- Make sure you update your gradle to the latest version (3.4.2 as of now)
- the previous action will require android Studio version 3.4 and above
- Clear your Gradle caches(use this command if on macOs
rm -rf $HOME/.gradle/caches/
) - Invalidate caches and restart, ...
- The rest will be just to change few implementations that were not refactored properly.
Think all should be find after that. Hope it saves you some time.
Solution 4:
- implementation androidx.appcompat:appcompat:1.0.0-alpha1
- implementation androidx.constraintlayout:constraintlayout:1.1.2
Post a Comment for "Migration To Androidx"