gpt4 book ai didi

android - APP 崩溃 onDetroy LVL

转载 作者:行者123 更新时间:2023-11-30 02:52:46 30 4
gpt4 key购买 nike

我对 Android LVL 有疑问,

应用程序在调用 mChecker.onDestroy() 时在 onDestroy 中崩溃;

private com.google.android.vending.licensing.LicenseChecker mChecker;
@Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
if (pd != null && pd.isShowing()) {
pd.dismiss();
}

InitialReport();

}

我该如何解决这个问题?

堆栈跟踪:

java.lang.RuntimeException: Unable to destroy activity {com.itbstudios.pilotlogbook/com.itbstudios.pilotlogbook.PilotLogbook_main}: java.lang.NullPointerException
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3712)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3730)
at android.app.ActivityThread.access$1500(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1333)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
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:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.itbstudios.pilotlogbook.PilotLogbook_main.onDestroy(Unknown Source)
at android.app.Activity.performDestroy(Activity.java:5623)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1123)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3699)
... 11 more

谢谢!

最佳答案

我只是遇到了完全相同的崩溃,在我的例子中,NullPointerException 来自

    mHandler.getLooper().quit();

因为在使用兑现许可证时我没有创建处理程序(但是 Looper 会在 LVL 的 onDestroy() 中自动退出)。所以,我的解决方案很简单:

    if ( mHandler != null ) {
mHandler.getLooper().quit();
}

关于android - APP 崩溃 onDetroy LVL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23853607/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com