2017-06-12 60 views
0

我試圖通過火力地堡實現谷歌登入到我的Android應用程序與下面的消息使我的搖籃同步之後出現:錯誤:任務':app:processDebugGoogleServices'的執行失敗。 com.google.android.gms的更新版本10.2.6

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.

我該如何解決這個錯誤?

這是我的搖籃文件:

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' 

回答

15

使用同一版本的所有火力地堡和谷歌播放庫:

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.0" 

您可以簡化版本號的維護並確保它們是總是這樣做:

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' 
} 
+1

'ext {}'真的很方便! +1 –

相關問題