2016-04-29 94 views
0

當我嘗試執行buid.gradle我得到的Android工作室的gradle構建失敗,谷歌播放服務版本

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 8.3.0. 

這個錯誤,這是模塊的build.gradle文件

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.gs.lasarenas" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:design:23.3.0' 
    compile 'com.google.android.gms:play-services:8.4.0' 
} 

在這個文件的播放服務版本是8.4.0,但我不知道我必須將版本從8.3.0更新到8.4.0

回答

4

更新

試試這個

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:25.0.0' 
    compile 'com.android.support:design:25.0.0' 
    compile 'com.google.android.gms:play-services:9.8.0' 
} 

apply plugin: 'com.google.gms.google-services' 

末添加'com.google.gms.google-services'解決了這個問題對我來說

希望它可以幫助

0
  1. 請勿使用jars
    • 刪除此行compile fileTree(include: ['*.jar'], dir: 'libs')
  2. 不要使用play-services
    • 請選擇一個喜歡:play-services-analytics

例如:

dependencies { 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:design:23.3.0' 
    compile 'com.google.android.gms:play-services-auth:8.4.0' 

    testCompile 'junit:junit:4.12' 
} 
+0

我想使用谷歌登入 – AFS

+1

檢查我的答案。請參閱google play服務:https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project。 –

0

試試這個

compile 'com.google.android.gms:play-services-gcm:8.4.0' 
相關問題