java - 我在没有调用 super.onResume() 的 firebase 控制台上崩溃
问题描述
我在每个活动中都调用 super.onresume,但仍然是 firebase 控制台上的崩溃报告。我有 BaseActivity,我在其中重写 onResume() 函数并从 BaseActivity 扩展每个活动。在某些活动中,我覆盖 onResume() 函数,而在某些活动中,我使用 BaseActivity onResume()
致命例外:
java.lang.RuntimeException: Unable to resume activity : android.util.SuperNotCalledException: Activity } did not call through to super.onResume()
at android.app.ActivityThread.performResumeActivity + 3725(ActivityThread.java:3725)
at android.app.ActivityThread.handleResumeActivity + 3775(ActivityThread.java:3775)
at android.app.ActivityThread$H.handleMessage + 1734(ActivityThread.java:1734)
at android.os.Handler.dispatchMessage + 110(Handler.java:110)
at android.os.Looper.loop + 232(Looper.java:232)
at android.app.ActivityThread.main + 6661(ActivityThread.java:6661)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 1106(ZygoteInit.java:1106)
at com.android.internal.os.ZygoteInit.main + 967(ZygoteInit.java:967)
abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
val BASE_EXTRA_TEXT_FOR_INTENT_INJECTION = "com.hello.world"
val KEY_INJECTION_EXTRA_STRING = "injection_extra_string"
var mDataBinding: T? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
try {
mDataBinding = DataBindingUtil.setContentView(this, setLayout())
if (intent.action != null && intent.action!!.equals(Intent.ACTION_MAIN, ignoreCase = true)) {
return
}
val isSafe = intent.hasExtra(KEY_INJECTION_EXTRA_STRING)
if (isSafe) {
val intentInjectionStr = intent.getStringExtra(KEY_INJECTION_EXTRA_STRING)
if (intentInjectionStr == null || !intentInjectionStr.equals(BASE_EXTRA_TEXT_FOR_INTENT_INJECTION + RootValues.getInstance().TIME_STAMP_FOR_INTENT_INJECTION)) {
finish()
}
} else {
finish()
}
} catch (ex: Exception) {
}
}
override fun onResume() {
try {
super.onResume()
if (intent.action != null && intent.action!!.equals(Intent.ACTION_MAIN, ignoreCase = true)) {
return
}
if (DeviceUtils.isDeviceRooted()) {
finish()
}
} catch (ignore: Exception) {
}
}
override fun onPostCreate(savedInstanceState: Bundle?) {
try {
super.onPostCreate(savedInstanceState)
init(savedInstanceState)
} catch (ignore: Exception) {
}
}
abstract fun setLayout(): Int
abstract fun init(savedInstanceState: Bundle?)
我想解决这个崩溃。这种崩溃有时会发生。
解决方案
推荐阅读
- ios - Google-Mobile-Ads-SDK 在主应用程序和框架中使用时因初始化错误而失败
- symfony - 迁移:每次我尝试运行迁移时加载迁移列表
- android - Fragment 从不接收来自共享 ViewModel 的 LiveData 更新
- javascript - 在开关中投射类型
- git - 父模块中的 git status 未显示子模块中的新提交
- apache - 反向代理尝试将子目录重定向到 Symfony 特定路由
- python - 在 Python 中序列化/反序列化类对象的最佳方法是什么?
- java - 并行流修改的 ArrayList 的大小
- c# - 为什么更改元素属性时此 Xamarin CollectionView 不更新 UI?
- windows - 启动 kafka 服务器时出现“java.nio.channels.UnresolvedAddressException”