Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.1: mixing versions can lead to runtime crashes

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.

like image 744
drmrbrewer Avatar asked Apr 20 '18 20:04

drmrbrewer


2 Answers

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'
like image 91
Mohamed Fares Avatar answered Nov 18 '22 05:11

Mohamed Fares


The above warning is not specific to media-compat dependency. They just added example to explain the issue. The issue get resolved by adding v4 lib for me.

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

in addition to

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

No need include

implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
like image 16
Ganesh Kanna Avatar answered Nov 18 '22 05:11

Ganesh Kanna