添加Android Facebook SDK依赖后
compile 'com.facebook.android:facebook-android-sdk:4.21.0'
我遇到了错误
compile 'com.android.support:appcompat-v7:25.3.1'
但项目运行良好。
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'
}
最佳答案
这个问题是由于下载了不同版本的依赖文件导致的。
明确将其也放入 gradle 文件中并再次同步。
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
在这个目录下可以找到正在下载的库
Project Files/Your project/.idea/libraries
关于android - 添加 Facebook Android SDK 依赖项后出现此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43256103/