gpt4 book ai didi

android - Android:主要异常

转载 作者:行者123 更新时间:2023-12-03 16:54:47 31 4
gpt4 key购买 nike

我收到以下日志,由于某种未知原因,我的 Activity 崩溃了。
此问题可能与admob有关。.请提出建议。

            02-18 22:30:45.122: W/dalvikvm(8179): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
02-18 22:30:45.232: V/webview(8179): destroy : called.
02-18 22:30:45.232: V/webview(8179): destroy : called.
02-18 22:30:45.232: V/webview(8179): destroy : called.
02-18 22:30:45.252: E/AndroidRuntime(8179): FATAL EXCEPTION: main
02-18 22:30:45.252: E/AndroidRuntime(8179): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.app.ContextImpl.startActivity(ContextImpl.java:625)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:229)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:336)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.os.Handler.dispatchMessage(Handler.java:99)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.os.Looper.loop(Looper.java:123)
02-18 22:30:45.252: E/AndroidRuntime(8179): at android.app.ActivityThread.main(ActivityThread.java:4633)
02-18 22:30:45.252: E/AndroidRuntime(8179): at java.lang.reflect.Method.invokeNative(Native Method)
02-18 22:30:45.252: E/AndroidRuntime(8179): at java.lang.reflect.Method.invoke(Method.java:521)
02-18 22:30:45.252: E/AndroidRuntime(8179): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
02-18 22:30:45.252: E/AndroidRuntime(8179): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-18 22:30:45.252: E/AndroidRuntime(8179): at dalvik.system.NativeStart.main(Native Method)
02-18 22:30:45.252: W/ActivityManager(175): Force finishing activity com.xyz.android/.SelectActivity

最好的祝福

最佳答案

您正在从广播接收器或某种服务启动Intent。由于这些组件未附加UI,因此您需要将FLAG_ACTIVITY_NEW_TASK附加到Intent。尝试类似的方法:

Intent intent = new Intent(context, Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

关于android - Android:主要异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14942327/

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