我正在按照本指南将 Google 登录功能集成到我的应用中 https://developers.google.com/identity/sign-in/android/start-integrating
这是我的应用级别 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.example"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
}
在添加 implementation 'com.google.android.gms:play-services-auth:15.0.1'
时,我在 implementation 'com.android.support:appcompat-v7 上出错:27.1.1'
错误是
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 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).
我查看了库文件夹,发现有两个版本号不同的库。见下图
如何解决这个问题?
最佳答案
在最后添加下面到你的应用程序级gradle
configurations.all {
resolutionStrategy {
eachDependency {
DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion "27.1.1"
}
}
}
}
}
关于android - 尝试在我的应用程序上集成 Google 登录时出现依赖性错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50735051/