Reputation: 43
I know this may sound a simple question and it has been answered several times on stackoverflow but I am a novice and unable to find a working solution from already answered threads. I my gradle I am getting this error:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found versions
26.1.0, 25.3.1, 25.2.0. Examples include `com.android.support:animated-vector
drawable:26.1.0` and `com.android.support:cardview-v7:25.3.1`
The app builds fine and also runs on few devices like API 22 but while testing I figured out that the app crashes on API 19 and few other lower APIs.
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "*******"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/activation.jar')
compile 'com.google.firebase:firebase-database:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'
compile 'com.google.firebase:firebase-storage:11.2.2'
compile 'com.google.android.gms:play-services:11.2.2'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.android.support:appcompat-v7:26.1.0' << Error with this line
compile 'com.android.support.constraint:constraint-layout:+'
compile 'com.android.support:multidex:1.0.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.github.bumptech.glide:glide:4.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 3
Views: 3326
Reputation: 6405
At first change your targetSdkVersion
to 26. You should use same version for android support libraries. You should correct your versions as below:
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0
As you are not compiling cardView explicitly, there might might be third party library which is using the version 25.3.1. To resolve this compile the below version too:
com.android.support:cardview-v7:26.1.0
And try to avoid using + signs in dependencies, they load bunch of unnecessary versions.
Upvotes: 2