更新时间:2022-10-25 09:58:58
对所有Firebase和Google Play库使用相同的版本:
compile'com.google.firebase:firebase-auth:11.0.0'
compile'com.google.firebase:firebase-messaging:11.0.0'
compile'com.google。 android.gms:play-services-auth:11.0.0'
当您进行更改时,您可以也可以使用最新版本的构建工具:
$ $ $ $ $ $ $ $ $ buildToolsVersion $ 26.0 $
code $>
您可以简化版本号的维护并保证e他们总是这样做:
$ $ p $ $ $ $ $ $ $ $ $ SUPPORT_LIB_VER = '25.3.1'
GOOGLE_LIB_VER = '11.0.0'
}
依赖关系{
编译fileTree(包括:''.jar'],dir:'libs')
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})
compilecom.android.support:appcompat-v7:$SUPPORT_LIB_VER
compile'com.android.support.constraint:constraint-layout:1.0.2'
compile com.android.support:design:$SUPPORT_LIB_VER
compilecom.android.support:support-vector-drawable:$SUPPORT_LIB_VER
compilecom.android.support:support-v4:$ SUPPORT_LIB_VER
compilecom.google.firebase:firebase-auth:$ GOOGLE_LIB_VER
compilecom.google.firebase:firebase-messaging:$ GOOGLE_LIB_VER
compilecom.google。 android.gms:播放 - 服务验证:$ GOOGLE_LIB_VER
编译commons-io:commons-io:2.0.1
testCompile'junit:junit:4.12'
}
I'm trying to implement Google Sign-In through Firebase into my Android app and the following message keeps appearing after my Gradle sync:
Error:Execution failed for task ':app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.2.6.
How can I fix this error?
Here's my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.sjf.lgcats"
minSdkVersion 15
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/2'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.firebase:firebase-messaging:10.2.6'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'
compile 'commons-io:commons-io:2.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Use the same version for all Firebase and Google Play libraries:
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'
While your making changes, you could also use the latest version of build tools:
buildToolsVersion "26.0.0"
You can simplify maintenance of version numbers and ensure they are always consistent by doing this:
ext {
SUPPORT_LIB_VER = '25.3.1'
GOOGLE_LIB_VER = '11.0.0'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:$SUPPORT_LIB_VER"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "com.android.support:design:$SUPPORT_LIB_VER"
compile "com.android.support:support-vector-drawable:$SUPPORT_LIB_VER"
compile "com.android.support:support-v4:$SUPPORT_LIB_VER"
compile "com.google.firebase:firebase-auth:$GOOGLE_LIB_VER"
compile "com.google.firebase:firebase-messaging:$GOOGLE_LIB_VER"
compile "com.google.android.gms:play-services-auth:$GOOGLE_LIB_VER"
compile 'commons-io:commons-io:2.0.1'
testCompile 'junit:junit:4.12'
}