2017-05-02 23 views
1

firebase認証、データベース、およびストレージサービスをアプリで使用しています。以前はうまくいきました。私はfirebaseのクラウドメッセージング設定をdocsに記述されているように追加しました。しかし、アプリは実行時にクラッシュします。私は約4時間問題を調査し、さまざまなソリューションを試しました。すべてのライブラリのバージョンを同じに保ち、appcompatライブラリのバージョンを変更し、appをmultidexに変更します。以下は私のGradleの依存関係である:アプリをコンパイルするにはFirebase APIの初期化に失敗しました。java.lang.reflect.InvocationTargetException

compile('com.digits.sdk.android:digits:[email protected]') { 
    transitive = true; 
} 

compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
compile 'com.android.support:design:25.3.1' 
compile 'com.android.support:percent:25.3.1' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
testCompile 'junit:junit:4.12' 

//Firebase 
compile 'com.google.android.gms:play-services:10.0.1' 
compile 'com.google.firebase:firebase-auth:10.0.1' 
compile 'com.google.firebase:firebase-database:10.0.1' 
compile 'com.google.firebase:firebase-storage:10.0.1' 
compile 'com.google.firebase:firebase-core:10.0.1' 
compile 'com.google.firebase:firebase-messaging:10.0.1' 
compile 'com.firebaseui:firebase-ui-storage:0.6.0' 

は、次の例外を生成します。

05-02 20:05:55.746 31927-31927/com.apponative.committeeapp A/FirebaseApp: Firebase API initialization failure. 
    java.lang.reflect.InvocationTargetException 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     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:1656) 
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627) 
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015) 
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589) 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522) 
     at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381) 
     at android.os.Handler.dispatchMessage(Handler.java:110) 
     at android.os.Looper.loop(Looper.java:193) 
     at android.app.ActivityThread.main(ActivityThread.java:5299) 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
     at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.NoSuchMethodError: com.google.android.gms.common.api.zzc.<init> 
     at com.google.android.gms.internal.zzbiu.<init>(Unknown Source) 
     at com.google.android.gms.internal.zzbjc.zza(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.zzbkg.<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.invokeNative(Native Method)  
     at java.lang.reflect.Method.invoke(Method.java:515)  
     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:1656)  
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627)  
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)  
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015)  
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589)  
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)  
     at android.app.ActivityThread.access$1500(ActivityThread.java:151)  
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)  
     at android.os.Handler.dispatchMessage(Handler.java:110)  
     at android.os.Looper.loop(Looper.java:193)  
     at android.app.ActivityThread.main(ActivityThread.java:5299)  
     at java.lang.reflect.Method.invokeNative(Native Method)  
     at java.lang.reflect.Method.invoke(Method.java:515)  
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)  
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)  
     at dalvik.system.NativeStart.main(Native Method)  
05-02 20:05:55.774 31927-31927/com.apponative.committeeapp A/FirebaseApp: Firebase API initialization failure. 
    java.lang.reflect.InvocationTargetException 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     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:1656) 
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627) 
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015) 
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589) 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522) 
     at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381) 
     at android.os.Handler.dispatchMessage(Handler.java:110) 
     at android.os.Looper.loop(Looper.java:193) 
     at android.app.ActivityThread.main(ActivityThread.java:5299) 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
     at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.NoSuchMethodError: com.google.android.gms.common.util.zzx.getNoBackupFilesDir 
     at com.google.firebase.iid.zzh.zzeG(Unknown Source) 
     at com.google.firebase.iid.zzh.<init>(Unknown Source) 
     at com.google.firebase.iid.zzh.<init>(Unknown Source) 
     at com.google.firebase.iid.zzd.zzb(Unknown Source) 
     at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source) 
     at java.lang.reflect.Method.invokeNative(Native Method)  
     at java.lang.reflect.Method.invoke(Method.java:515)  
     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:1656)  
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627)  
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)  
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015)  
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589)  
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)  
     at android.app.ActivityThread.access$1500(ActivityThread.java:151)  
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)  
     at android.os.Handler.dispatchMessage(Handler.java:110)  
     at android.os.Looper.loop(Looper.java:193)  
     at android.app.ActivityThread.main(ActivityThread.java:5299)  
     at java.lang.reflect.Method.invokeNative(Native Method)  
     at java.lang.reflect.Method.invoke(Method.java:515)  
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)  
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)  
     at dalvik.system.NativeStart.main(Native Method)  
05-02 20:05:55.818 31927-31927/com.apponative.committeeapp A/FirebaseApp: Firebase API initialization failure. 
    java.lang.reflect.InvocationTargetException 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     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:1656) 
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627) 
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015) 
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589) 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522) 
     at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381) 
     at android.os.Handler.dispatchMessage(Handler.java:110) 
     at android.os.Looper.loop(Looper.java:193) 
     at android.app.ActivityThread.main(ActivityThread.java:5299) 
     at java.lang.reflect.Method.invokeNative(Native Method) 
     at java.lang.reflect.Method.invoke(Method.java:515) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
     at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.NoSuchMethodError: com.google.android.gms.internal.zzapn.zzb 
     at com.google.android.gms.internal.zzbku.<clinit>(Unknown Source) 
     at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source) 
     at java.lang.reflect.Method.invokeNative(Native Method)  
     at java.lang.reflect.Method.invoke(Method.java:515)  
     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:1656)  
     at android.content.ContentProvider.attachInfo(ContentProvider.java:1627)  
     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)  
     at android.app.ActivityThread.installProvider(ActivityThread.java:5015)  
     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589)  
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)  
     at android.app.ActivityThread.access$1500(ActivityThread.java:151)  
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)  
     at android.os.Handler.dispatchMessage(Handler.java:110)  
     at android.os.Looper.loop(Looper.java:193)  
     at android.app.ActivityThread.main(ActivityThread.java:5299)  
     at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)  
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)  at dalvik.system.NativeStart.main(Native Method)  
05-02 20:05:55.845 31927-31927/com.apponative.committeeapp A/FirebaseApp: Firebase API initialization failure. 
    java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) 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:1656) at android.content.ContentProvider.attachInfo(ContentProvider.java:1627) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) at android.app.ActivityThread.installProvider(ActivityThread.java:5015) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589)at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5299) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.VerifyError: com/google/android/gms/internal/zzatp at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515)  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:1656)  at android.content.ContentProvider.attachInfo(ContentProvider.java:1627)  at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) at android.app.ActivityThread.installProvider(ActivityThread.java:5015)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:4589)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)  at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381) at android.os.Handler.dispatchMessage(Handler.java:110)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:5299) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)  
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)  
     at dalvik.system.NativeStart.main(Native Method)  
05-02 20:05:56.468 31927-31927/com.apponative.committeeapp E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering 
05-02 20:05:56.842 31927-31927/com.apponative.committeeapp E/AndroidRuntime: FATAL EXCEPTION: main 
    Process: com.apponative.committeeapp, PID: 31927 
    java.lang.NoSuchMethodError: com.google.android.gms.common.api.zzc.<init>  at com.google.android.gms.internal.zzbiu.<init>(Unknown Source)    at com.google.android.gms.internal.zzbjc.zza(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.zzbkg.<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 com.apponative.committeeapp.firebase.FireBaseAuth.fireBaseAuth(FireBaseAuth.java:42)    

答えて

1

あなたは依存関係としてcom.google.android.gms:play-services:10.0.1を含めるべきではありません。これにより、すべてのGoogle PlayサービスAPIがビルドに追加され、おそらくMultiDexを使用する必要があります。代わりに、のセクションのSetup Guideに記載されている指示に従ってください。にAPIを選択的にコンパイルして、実際に使用する特定のAPIを追加します。

また、Firebase UIライブラリのバージョンは、Firebaseライブラリのバージョンと互換性がある必要があります。互換性のあるバージョンのテーブルは、Firebase UI documentationに含まれています。 Firebase APIバージョン10.0.1の場合、firebase-ui-storage:1.1.1

+0

私はあなたの提案を試みましたが、成功しなかった問題はまだ同じです –

+0

@SairaNawazあなたの質問を更新してください。 Firebase UI v0.6.0はFirebase 10.x.xと互換性がないためです。私たちはそれが問題ではないことを知る必要があります。また、 'play-services'の依存関係を削除します。重要な部品は自動的に追加されます。それ以降はきれいにしてください。 –

+0

@EugenPechanec thanx、問題は解決しました。私はメッセージングAPIを削除しなければならず、クリーニング後、Bobの提案を再構築しました –

関連する問題