我在Google Play商店中有一个应用程序,它适用于大多数人。然而,有90个死机的报道,通过谷歌崩溃报告,有以下:来自Google Play的AndroidRuntimeException崩溃报告
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:847)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:276)
at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:242)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:330)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4429)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:3151)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:2918)
at dalvik.system.NativeStart.main(Native Method)
我已经在网络上四处看了一下,但所有我能找到的是添加intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
。
但这不适用于我,因为我不会在我的代码中调用startActivity()
。我确实打电话给startActivityForResult()
,但指定FLAG_ACTIVITY_NEW_TASK
标志会停止onActivityResult()
返回的结果。
这里是代码的唯一的一块已startActivityForResult()
从onCreate()
在我的主要活动名为:
private void load()
{
Intent loadBeats = new Intent(this, BeatListActivity.class);
startActivityForResult(loadBeats, SELECT_BEAT_ACTIVITY);
}
我从来没有真正发生过这种错误,我对我的任何设备或虚拟设备!这一切都很难解决。
任何想法?
'webkit'有点线索。看到这个问答:http://stackoverflow.com/questions/6481178/androidruntimeexception-when-a-hyperlink-is-clicked-in-dialog-shown-on-first-run –
@ReubenScratton不知道这是如何相关的。我不使用网址,我的应用程序从图标开始,它启动主要的活动。 – James
你的项目中有没有WebView? –