匿名登录时Firebase在Android上崩溃
市场上大约70%的设备都出现了这种崩溃。然而,在测试过程中,它从未出现过匿名登录时Firebase在Android上崩溃,android,firebase,firebase-authentication,Android,Firebase,Firebase Authentication,市场上大约70%的设备都出现了这种崩溃。然而,在测试过程中,它从未出现过 public class MyApp extends Application{ public void onCreate() { super.onCreate(); FirebaseDatabase.getInstance().setPersistenceEnabled(true); FirebaseAuth.getInstance().signInAnonymously()
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测试实验室获取问题的视频。当机器人点击一个广告(广告支持的应用程序)然后返回应用程序时,它发生了。因此,它可能与FirebaseAuth.getInstance()有关;被打了两次电话?但是,Application.onCreate()只应调用一次。我知道Firebase崩溃报告中有一个已知的bug,它将导致创建两个应用程序实例,但我们没有使用sdk,因为它们解决了这个问题 您好,我有一个类似的问题,在几天没有解决方案之后,我发现appcompat存在版本问题,因此我更改了以下内容:
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'
为此:
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'
在应用程序graddle中,我的问题解决了,很抱歉我的英语不好我使用Firebase测试实验室来查找问题。它在他们的一台设备上坠毁了,我观看了发生的事情的视频。我们的应用程序支持广告。在测试过程中,我们不会点击自己的广告,所以这一点从未出现过。崩溃发生在用户单击广告然后重新进入应用程序之后。我找到的解决方案与此问题相同 我认为Application.onCreate()被多次调用。尽管这永远不会发生 编辑:此答案无效 经过4人质量保证团队整整一周的测试。在7台测试设备上运行58个单元并连接了浓缩咖啡测试。然后使用谷歌测试实验室在数十台云设备上运行多个测试。问题从未发生过。那么在发布日的前半个小时内,有500次崩溃!?70%的车祸率。回到原点 最终答案:Proguard问题 我在proguard-rules.pro中添加了这两行
#Firebase Authentication
-keepattributes Signature
-keepattributes *Annotation*
问题已解决。更新您的build.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'
大约70%的设备发生故障,这是一个巨大的数字。也许您可以使用在线测试场对firebase崩溃进行测试。@itnotmenow我正在寻找一种新的测试方法,可以找到这种方法。我们在一个小型设备场上进行单元测试和连接测试。我们只有十几台设备可以测试。作为一家小公司,做得比我们已经做的更多是一个财政困难。所以有些问题需要客户去发现。@theJosh你已经将
google services.json
下载到你的应用程序目录,并在Firebase控制台上授权了包名和SHA1签名吗?因为这是Firebase的问题,如果我将其更新到最新版本,它会起作用吗?
#Firebase Authentication
-keepattributes Signature
-keepattributes *Annotation*
// 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'