【问题标题】:Android App freezes after implementing Google FirebaseAndroid 应用在实施 Google Firebase 后冻结
【发布时间】:2016-06-06 14:28:24
【问题描述】:

这是我的 build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-analytics:9.0.2'
    compile 'com.google.firebase:firebase-ads:9.0.2'
    compile 'com.google.firebase:firebase-crash:9.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
}
apply plugin: 'com.google.gms.google-services'

应用程序在恢复时冻结。它给出了 anr(活动没有响应)错误。

play services 9.0+ 或 firebase 有什么问题吗?

【问题讨论】:

  • 你的应用程序在哪里冻结,你的 anr 日志在哪里?
  • 当我从最小化状态回到应用程序时,例如前。我在正在运行的应用程序上按主页按钮,然后返回应用程序,然后应用程序冻结,几秒钟后它给出了 anr。
  • 我在日志中看到了类似的问题:D/FirebaseApp: Notifying background state change listeners。
  • Parte Patel,你有 logcat 的副本吗,你使用的是 Android Studio 的版本。
  • 只是为了补充一点,得到同样的问题,使用相同的 firebase 模块。我的经验是该应用程序在后台运行之前运行良好,有时它第一次返回正常,但从不超过一次,第二次它挂起,看起来 UI 线程被锁定。这是最近一次崩溃中的ANR log。此外,使用 Android Studio 2.2 Preview 2。Logcat 仅显示上面提到的调试消息@Innova 没有错误

标签: android firebase google-play-services


【解决方案1】:

我通过删除该行解决了这个问题

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

【讨论】:

  • 头痛 3 天后,我找到了这个答案。我无法在没有 Google 服务的情况下发布我的应用,因为我想展示 Admob 的广告。感谢上帝,我没有添加play-services.9.0.2,而是添加了compile 'com.google.android.gms:play-services-ads:9.0.2',问题就消失了。
【解决方案2】:

似乎和这个问题一样:Firebase Crash produces ANR during launch

该事件的official fix 是对 Google Play 服务的更新,现在应该推出。

我们已修复 Google Play 服务 9.6.83 中的 Firebase 崩溃初始化问题。用户应该会在接下来的两天内收到更新。我们将对这个问题进行内部调查,并对我们的系统进行适当的改进,以防止或尽量减少未来的再次发生。

【讨论】:

    【解决方案3】:

    只需将这一行添加到依赖项中:

    implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-27
      • 1970-01-01
      • 1970-01-01
      • 2018-12-08
      • 2017-06-17
      • 1970-01-01
      • 2021-08-28
      相关资源
      最近更新 更多