2017-07-19 75 views
0

當我添加一行:在文件的build.gradle現在同步點擊AndroidStudio編譯「10.0.1 com.google.firebase:火力點的消息」:錯誤:任務':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.0.1.

我刪除了這一行apply plugin:'com.google.gms.google-services',那麼錯誤消失。但是,firebase-auth失敗:由以下原因引發:java.lang.IllegalStateException:缺省的FirebaseApp在此進程br.ufrn.imd.sgr中未初始化。確保首先調用FirebaseApp.initializeApp(Context)。

請幫助我。

的build.gradle(項目)

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

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

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

的build.gradle(應用模塊):

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.3" 
    defaultConfig { 
     applicationId "package.exemplo" 
     minSdkVersion 21 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    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:design:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 

    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.google.firebase:firebase-auth:11.0.2' 
    compile 'com.google.code.gson:gson:2.6.2' 
    compile project (':volley') 
} 


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

回答

0

這裏的交易:您添加太老依賴。 你的火力地堡驗證依賴版本11.0.2

compile 'com.google.firebase:firebase-auth:11.0.2' 

而且你增加了一個火力地堡的依賴與10.0.1版本:

compile 'com.google.firebase:firebase-messaging:10.0.1' 

所以有依賴關係版本衝突。這就是爲什麼當你嘗試同步時你有Gradle構建錯誤。

爲了解決這只是讓你firebase-messaging依賴版本最新的一個,並重新申請谷歌服務搖籃插件:

dependencies { 
    ... 

    compile 'com.google.firebase:firebase-auth:11.0.2' 
    compile 'com.google.firebase:firebase-messaging:11.0.2' 

    ... 
} 

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

希望這有助於。

+0

工作過,謝謝。 –

+0

@RaimundoNeto然後接受答案,順便說一句。 :) –

相關問題