我的项目中没有使用firebase但仍然引发Firebase API初始化失败

时间:2016-12-23 05:15:43

标签: android firebase firebase-analytics

我没有在我的Android项目中使用Firebase,甚至没有任何与Firebase相关的代码,但是我的应用程序抛出了如下所示的致命错误。请指南。

Firebase API初始化失败

java.lang.reflect.InvocationTargetException
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.google.firebase.FirebaseApp.zza(Unknown Source)
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
     at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1750)
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1719)
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
     at android.app.ActivityThread.installProvider(ActivityThread.java:5229)
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803)
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743)
     at android.app.ActivityThread.access$1500(ActivityThread.java:169)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
     at android.os.Handler.dispatchMessage(Handler.java:111)
     at android.os.Looper.loop(Looper.java:194)
     at android.app.ActivityThread.main(ActivityThread.java:5546)
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
  Caused by: java.lang.IllegalArgumentException: Given String is empty or null
     at com.google.android.gms.common.internal.zzac.zzhz(Unknown Source)
     at com.google.android.gms.internal.zzagt$zza$zza.<init>(Unknown Source)
     at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
     at com.google.firebase.auth.FirebaseAuth.<init>(Unknown Source)
     at com.google.android.gms.internal.zzahe.<init>(Unknown Source)
     at com.google.firebase.auth.FirebaseAuth.zzd(Unknown Source)
     at com.google.firebase.auth.FirebaseAuth.zzc(Unknown Source)
     at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
     at java.lang.reflect.Method.invoke(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:372) 
     at com.google.firebase.FirebaseApp.zza(Unknown Source) 
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
     at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1750) 
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1719) 
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
     at android.app.ActivityThread.installProvider(ActivityThread.java:5229) 
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803) 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743) 
     at android.app.ActivityThread.access$1500(ActivityThread.java:169) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484) 
     at android.os.Handler.dispatchMessage(Handler.java:111) 
     at android.os.Looper.loop(Looper.java:194) 
     at android.app.ActivityThread.main(ActivityThread.java:5546) 
     at java.lang.reflect.Method.invoke(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:372) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

无法初始化崩溃报告

java.lang.RuntimeException: Missing an expected resource: 'R.string.google_api_key' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
   at bmh.b(:com.google.android.gms.DynamiteModulesC:30)
   at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.init(:com.google.android.gms.DynamiteModulesC:70)
   at bky.onTransact(:com.google.android.gms.DynamiteModulesC:60)
   at android.os.Binder.transact(Binder.java:385)
   at com.google.firebase.crash.internal.zzd$zza$zza.zza(Unknown Source)
   at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source)
   at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.google.firebase.FirebaseApp.zza(Unknown Source)
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1750)
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1719)
   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
   at android.app.ActivityThread.installProvider(ActivityThread.java:5229)
   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743)
   at android.app.ActivityThread.access$1500(ActivityThread.java:169)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
   at android.os.Handler.dispatchMessage(Handler.java:111)
   at android.os.Looper.loop(Looper.java:194)
   at android.app.ActivityThread.main(ActivityThread.java:5546)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

我真的不想导入Firebase只是为了解代码时出现的致命错误。

依赖关系:

dependencies {
    compile project(':braintreePaymentLibrary')
    compile 'com.google.android.gms:play-services:9.6.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    //    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile fileTree(include: '*.jar', dir: 'libs')
    compile 'com.thrivecom:ringcaptcha:1.0.8@aar'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile files('libs/fastjson-1.1.33.android.jar')
    compile 'com.github.clans:fab:1.6.3'
    compile 'com.github.eluleci:flatui:3.0.0'
    compile 'com.android.support:support-v4:23.+'
    compile 'com.daimajia.swipelayout:library:1.2.0@aar'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
        transitive = true;
    }
    compile project(':mcalendarview')
    compile 'me.everything:overscroll-decor-android:1.0.3'
    compile 'com.jaredrummler:material-spinner:1.1.0'
    compile files('libs/httpmime-4.3.6.jar')
    compile files('libs/httpcore-4.3.3.jar')
    compile files('libs/httpclient-4.3.6.jar')
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
}

1 个答案:

答案 0 :(得分:3)

此依赖项包括所有Play服务API,包括Firebase:

compile 'com.google.android.gms:play-services:9.6.0'

将该依赖项替换为您需要的特定Play服务API。它们列在Play Services Setup Guide表1 中。