Android Studio 3.1: mixing versions can lead to ru

2020-06-01 07:05发布

Have recently upgraded to Android Studio 3.1, and at the same time I'm trying the Android P preview.

I'm getting the following error on compiling:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha1 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

But I cannot see any instance of 26.1.0 anywhere. All I have in my gradle is:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'

I've tried clearing caches, rebuilding app, etc. But error remains.

11条回答
Juvenile、少年°
2楼-- · 2020-06-01 07:48

Simple and easy solution is to add manually conflicting versions of android-support.

Mixing version can lead to runtime crashes

Just follow and solve your issue.

go to your gradle script-->build gradle(Module:app) in the dependency section and implement the conflicting version for ease go to the link.

Make sure there is no space during implementation.

implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

you can follow the link.

查看更多
叛逆
3楼-- · 2020-06-01 07:50

add in dependencies of build.grad (Module.app)

dependencies {
 //noinspection GradleCompatible
 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support:animated-vector-drawable:28.0.0'
 implementation 'com.android.support:support-media-compat:28.0.0'
}
查看更多
放荡不羁爱自由
4楼-- · 2020-06-01 07:54

I think your gradle file has the below dependency. Add this to your app level build.gradle.

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:mediarouter-v7:28.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
查看更多
5楼-- · 2020-06-01 07:59

In my case adding support-v4 helped me to got loose of warning.

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    // other dependencies
}
查看更多
趁早两清
6楼-- · 2020-06-01 08:00

You need to override the conflicted libraries by adding the conflicted libraries to your dependencies block

dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:customtabs:28.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
implementation 'com.android.support:support-media-compat:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
查看更多
登录 后发表回答