2016-07-29 123 views
0

大家好我建立我在哪裏使用火力地堡雲通訊和融合位置提供者,當我把熔融位置提供到應用程序,我得到這個錯誤爲應用火力地堡:「NoClassDefFoundError的:com.google.firebase.FirebaseOptions」與火力地堡

07-29 13:40:06.590 12635-12635/com.telnet.asp E/AndroidRuntime: FATAL EXCEPTION: main 
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions 
at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java) 
at android.content.ContentProvider.attachInfo(ContentProvider.java) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java) 
at android.app.ActivityThread.access$1400(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java) 
at android.os.Handler.dispatchMessage(Handler.java) 
at android.os.Looper.loop(Looper.java) 
at android.app.ActivityThread.main(ActivityThread.java) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 
at dalvik.system.NativeStart.main(Native Method) 

這是我的搖籃:

android { 
    dexOptions { 
     incremental = true; 
     javaMaxHeapSize "4g" 
    } 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 
    compileOptions.incremental = false 

    defaultConfig { 
     applicationId "com.telnet.asp" 

     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 

     multiDexEnabled true 

    } 

    dataBinding { 
     enabled = true 
    } 

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

dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     testCompile 'junit:junit:4.12' 
     apt 'com.google.dagger:dagger-compiler:2.2' 
     provided 'javax.annotation:jsr250-api:1.0' 
     compile project(path: ':domain') 
     compile project(path: ':data') 
     compile 'com.android.support:appcompat-v7:23.4.0' 
     compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0-rc2' 
     compile 'com.android.support:design:23.4.0' 
     compile 'javax.inject:javax.inject:1' 
     compile 'com.squareup.retrofit2:retrofit:2.1.0' 
     compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
     compile 'io.reactivex:rxandroid:1.2.1' 
     compile 'io.reactivex:rxjava:1.1.6' 
     compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 
     compile 'com.google.dagger:dagger:2.2' 
     compile 'com.android.support:support-v4:23.4.0' 
     compile 'com.jakewharton:butterknife:6.1.0' 
     compile 'net.danlew:android.joda:2.9.4.1' 
     compile 'com.android.support:percent:23.4.0' 
     compile 'com.squareup.picasso:picasso:2.5.2' 
     compile 'com.google.firebase:firebase-messaging:9.0.0' 
     compile 'com.google.android.gms:play-services:9.0.0' 
    } 
    apply plugin: 'com.google.gms.google-services' 

什麼是我的錯誤,我該如何解決? 編輯:當我降級到谷歌玩8.4.0服務我得到這個錯誤:

Error:Execution failed for task ':presentation: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 9.0.0. 
+0

的可能的複製HTTP:/ /stackoverflow.com/questions/37360126/getting-exception-java-lang-noclassdeffounderror-com-google-firebase-firebaseop –

+0

@Atenica嘗試[此](http://stackoverflow.com/a/38178935/5744335)溶液。讓我知道它是否有效。 – Arshak

+0

@Arshak降級似乎是一個壞的解決方案......如果你想用一個新的API功能? –

回答

0

我認爲你必須使用'com.google.firebase:firebase-ads:9.0.2',而不是播放服務'com.google.android.gms:play-services:9.0.0'這裏的信息https://firebase.google.com/docs/android/setup#add_the_sdk

+0

如果這個用戶真的需要使用一些Google API,該怎麼辦? –

+0

我認爲有甚至可以做到這一點。看文檔。 – Naveen