报错:
Your project has set android.useAndroidX=true
, but configuration :app:debugRuntimeClasspath
still contains legacy support libraries, which may cause runtime issues.
This behavior will not be allowed in Android Gradle plugin 8.0.
Please use only AndroidX dependencies or set android.enableJetifier=true
in the gradle.properties
file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).
The following legacy support libraries are detected:
:app:debugRuntimeClasspath -> com.squareup.picasso:picasso:2.71828 -> com.android.support:support-annotations:27.1.0
:app:debugRuntimeClasspath -> com.squareup.picasso:picasso:2.71828 -> com.android.support:exifinterface:27.1.0
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-compat:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-media-compat:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-core-utils:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-core-ui:25.3.1
:app:debugRuntimeClasspath -> com.journeyapps:zxing-android-embedded:3.6.0 -> com.android.support:support-v4:25.3.1 -> com.android.support:support-fragment:25.3.1
问题分析:从 Android Gradle plugin 8.0 开始,将不再允许这种行为。
解决方法:项目文件gradle.properies中添加
android.enableJetifier=true
以便将项目迁移到 AndroidX