2016-09-24 121 views
6

就照FB文檔here但 我仍然得到以下錯誤一切編譯時:無法解析:com.google.firebase:火力核心:9.6.0

Error:(44, 13) Failed to resolve: com.google.firebase:firebase-core:9.6.0 

我的SDK經理說,一切是最新的:

Google Play services Rev. 33 installed 
Google Repository Rev. 35 installed 

這是我的build.gradle內容:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.3' 

    defaultConfig { 
     applicationId "xxxx.xxxx" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 14 
     versionName "1.0" 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    // Support libraries 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    // Google APIs 
    // Note: Avoid compiling the entire play-services package. 
    compile 'com.google.android.gms:play-services-gcm:9.4.0' 
    compile 'com.google.android.gms:play-services-location:9.4.0' 
    compile 'com.google.android.gms:play-services-maps:9.4.0' 
    compile 'com.google.android.gms:play-services-places:9.4.0' 
    compile 'com.google.maps.android:android-maps-utils:0.4.4' 

    compile 'org.jsoup:jsoup:1.9.2' 
    compile 'com.google.code.gson:gson:2.7' 
    compile 'io.branch.sdk.android:library:2.+' 
    compile 'com.google.firebase:firebase-core:9.6.0' //<-- CAUSING TROUBLE 
} 

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

這是我的根級build.gradle內容:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.3' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

爲什麼不編譯?

回答

2

嘗試compile 'com.google.firebase:firebase-messaging:9.4.0'代替compile 'com.google.firebase:firebase-core:9.6.0'

5

您需要使用相同版本的Firebase和Google Play服務。所以,如果你想更新到9.6.0火力地堡的SDK,你也應該更新其他依賴關係:

compile 'com.google.android.gms:play-services-gcm:9.6.0' 
compile 'com.google.android.gms:play-services-location:9.6.0' 
compile 'com.google.android.gms:play-services-maps:9.6.0' 
compile 'com.google.android.gms:play-services-places:9.6.0' 
7

@Lorenzo Quiroli提供可能會幫你回答,你所需要的相同版本的Firebase和Google Play服務。

就我而言,我已將所有設置設置爲9.6.0,但仍然出現錯誤。我解決它通過在SDK管理器更新到最新的谷歌播放服務和谷歌庫:

enter image description here

現在我知道這不會幫助你,因爲你已經更新了這些,但它可能會幫助其他人。