I\'m refactoring an app to use androidx. I have struggled to get rid of all the libraries that do not support it. I thought I had removed all the libraries that use the sup
Try to MIGRATE to ANDROIDX from the following path in Android Studio:
(Refactor>Migrate to AndroidX...)
I think the problem is due to conflicting dependencies. In my case, the problem went away when I removed androidx dependency.
From:
dependencies {
implementation "androidx.work:work-runtime:2.1.0"
}
To:
dependencies {
implementation "android.arch.work:work-runtime:1.0.1"
}
This may not be possible if you are too dependendent on androidx.
I have very similar problem and in my case solution is add in gradle.properties
this two lines:
android.useAndroidX=true
android.enableJetifier=true
I hope it will help.
You can use ./gradlew tasks --all
to find out which tasks you have. Among them there will be something like yourproject:dependencies
, which you can run to get dependency tree like this:
./gradlew yourproject:dependencies
I got the same issue while adding,
dataBinding {
enabled = true
}
in app.gradle module. My gradle dependency is as:
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.google.android.material:material:1.0.0-alpha3'
When I changed to,
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
I could get rid out of the error while running the project.
just marge dependency on AndroidX Library.
Example: app/build.gradle:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
to:
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Than rebuild again, shows many errors. just comment out these old libraries. re-import android x library package. Example below:
Marge AndroidX: https://developer.android.com/jetpack/androidx/migrate
I hope to solve your problem.