0

我收到以下日志,我的活动由于某种未知原因而崩溃。这个问题可能与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

此致

4

2 回答 2

1

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

Intent intent = new Intent(context, Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
于 2013-02-18T17:53:30.793 回答
0

这是 admob 的一些奇怪的错误。使用最新的 jar 为我修复了它。

于 2013-03-20T10:58:25.877 回答