2016-07-22 9 views
15

私は、市場で約70%のデバイスでこのクラッシュを受けています。しかし、それは決してテスト中に出てこなかった。匿名ログイン中にAndroidでFirebaseがクラッシュする

public class MyApp extends Application{ 
public void onCreate() { 
     super.onCreate(); 
     FirebaseDatabase.getInstance().setPersistenceEnabled(true); 
     FirebaseAuth.getInstance().signInAnonymously(); 
    } 
} 

これはエラーです。

Fatal Exception: java.lang.RuntimeException: Unable to create application com.mycompany.myapp.activities.MyApp: java.lang.ClassCastException: com.google.android.gms.internal.hc cannot be cast to com.google.firebase.auth.c 
com.google.android.gms.internal.hc cannot be cast to com.google.firebase.auth.c 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4927) 
    at android.app.ActivityThread.access$1500(ActivityThread.java:153) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:157) 
    at android.app.ActivityThread.main(ActivityThread.java:5633) 
    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:896) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712) 
    at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.ClassCastException: com.google.android.gms.internal.hc cannot be cast to com.google.firebase.auth.c 
    at com.google.android.gms.internal.aa.a(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.a(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.d(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.<init>(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.<init>(Unknown Source) 
    at com.google.android.gms.internal.z.<init>(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.c(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.b(Unknown Source) 
    at com.google.firebase.auth.FirebaseAuth.b(Unknown Source) 
    at com.tesseractmobile.solitairesdk.activities.SolitaireApp.onCreate(SolitaireApp.java:123) 
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020) 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4924) 

私は今、私はちょうど私たちのアプリでfirebaseを無効にしていますfirebase 9.2.1

compile "com.google.firebase:firebase-core:${firebaseVersion}" 
compile "com.google.firebase:firebase-database:${firebaseVersion}" 
//For dynamic links 
compile "com.google.firebase:firebase-invites:${firebaseVersion}" 
//Authentication - for logging winning games 
compile "com.google.firebase:firebase-auth:${firebaseVersion}" 

を使用しています。私たちはそれがいかに安定しているかを見るためにそれをテストしていました。私はそれがなぜ私たちのテスト装置のすべてで働いたのかを知りませんでした。

更新: Firebase Test Labを使用して問題のビデオを取得することができました。それはロボットが広告(広告がサポートされているアプリ)をクリックしてアプリに戻ったときに発生しました。 FirebaseAuth.getInstance()と何か関係があります。signInAnonymously();二度呼ばれる?しかし、Application.onCreate()は一度だけ呼び出されるべきです。 Firebaseのクラッシュレポートには、2つのアプリケーションインスタンスが作成される既知のバグがありますが、私たちはそのsdkユーティリティを使用して問題を解決していません。

+0

*クラッシュのための膨大な数のデバイス*が約70%です。おそらく、オンラインテストファームを使ってfirebaseクラッシュをテストすることができます。 –

+0

@itnotmenow私はこれを見つける新しいテスト方法を探しています。小さなデバイスファームでユニットテストと接続テストを行います。私たちはテストするデバイスが十数個しかありません。中小企業としては、すでに行っていることよりも多くのことを行うことは財政難です。だから、いくつかの問題は顧客が見つけなければならないものです。 – theJosh

+0

@theJoshあなたのアプリケーションディレクトリに 'google-services.json'をダウンロードし、Firebaseコンソールでパッケージ名とSHA1署名の両方を承認しましたか? –

答えて

3

私はFirebase Test Labを使用して問題を発見しました。彼らのデバイスの1つでクラッシュし、私は何が起こったのビデオを見た。私たちのアプリは広告をサポートしています。私たちはテスト中に自分の広告をクリックしないので、これは決して起こりません。クラッシュは、ユーザーが広告をクリックしてアプリに再び入った後に発生します。私が見つけた解決策はこの問題と同じでした。 FirebaseApp with name [DEFAULT] doesn't exist

 if (!FirebaseApp.getApps(this).isEmpty()){ 
      FirebaseDatabase.getInstance().setPersistenceEnabled(true); 
      FirebaseAuth.getInstance().signInAnonymously(); 
     } 

私はApplication.onCreate()が複数回呼ばれていると思います。それは決して起こるべきではありません。

EDIT:この回答は4人のQAチームによってテストのフル週間後

を動作しません。 7台のテスト装置でエスプレッソと58台のユニットと接続テストを実行。その後、Google Test Labを使用して数十のクラウドデバイスで複数のテストを実行します。問題は起こりませんでした。その後、リリース日に、最初の30分に500のクラッシュ!? 70%の衝突率。だから正方形に戻る。

FINAL ANSWER:ProGuardの問題

私は解決の私proguard-rules.pro

#Firebase Authentication 
-keepattributes Signature 
-keepattributes *Annotation* 

問題にこれらの2行を追加しました。

+0

火災の問題であるため、最新のバージョンにアップデートすると動作しますか? –

-1

こんにちは私は解決策のない日後、私はそれがAPPCOMPATとバージョンの問題だものを見つけ、同様の問題を抱えているので、私は、この変更:で

compile 'com.android.support:appcompat-v7:23.3.0' 
compile 'com.android.support:design:23.3.0' 
compile 'com.android.support:support-v4:23.3.0' 

:これまで

compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.android.support:design:23.4.0' 
compile 'com.android.support:support-v4:23.4.0' 

をアプリのぼんやりと私の問題は解決しました。私の英語には申し訳ありません。

-1

ビルドを更新します。gradle:

// Firebase Gradle 
compile "com.google.firebase:firebase-auth:9.4.0" 
compile 'com.google.firebase:firebase-storage:9.4.0' 
compile 'com.google.firebase:firebase-messaging:9.4.0' 
compile 'com.google.firebase:firebase-database:9.4.0' 
compile 'com.google.firebase:firebase-core:9.4.0' 
関連する問題