After adding Android Facebook SDK dependencies
compile 'com.facebook.android:facebook-android-sdk:4.21.0'
I'm getting error in
compile 'com.android.support:appcompat-v7:25.3.1'
But Project is running fine.
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 25.0.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:cardview-v7:25.0.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.)
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "sujeet.raj.com"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.facebook.android:facebook-android-sdk:4.21.0'
}
Don't ask me why but this solved it for me:
android {
/.../
configurations.all {
resolutionStrategy.force 'com.android.support:cardview-v7:27.1.0'
resolutionStrategy.force 'com.android.support:animated-verctor-drawable:27.1.0'
resolutionStrategy.force 'com.android.support:customtabs:27.1.0'
resolutionStrategy.force 'com.google.android.gms:play-services-base:12.0.1'
resolutionStrategy.force 'com.google.android.gms:play-services-auth:12.0.1'
}
}
This problem occurs due to different version of dependency files get downloaded.
Explicitly put this as well in gradle file and sync again.
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
Under this directory you can find these libraries getting downloaded
Project Files/Your project/.idea/libraries
You can solve this with one of the following solutions: original here
Run a Gradle dependency report to see what your full tree of dependencies is. From there, you will see which one of your libraries is asking for a different version of the Android Support libraries. For whatever it is asking for, you can ask for it directly with the 25.2.0 version, or use Gradle's other conflict resolution approaches to arrange to get the same version.
Run:
./gradlew -q dependencies <module-name>:dependencies --configuration compile
Example:
./gradlew -q dependencies app:dependencies --configuration compile
For me, the error disappeared after removing com.google.android.gms:play-services:10.2.0
And only include com.google.android.gms:play-services-location:10.2.0 and com.google.android.gms:play-services-maps:10.2.0 as they are the only two play services that I use.
I think the gms:play-services depend on some old components of the support library, so we need to add them explicitly ourselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With