几个月前,我的应用程序在其他应用程序的意图启动时工作正常。现在,当我的应用程序通过意图启动时,我收到错误:
03-21 12:00:43.096 Google Pixel 3 XL Info 1234 ActivityManager Showing crash dialog for package com.comp.myapp u0
03-21 12:00:43.085 Google Pixel 3 XL Error 5860 AndroidRuntime --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <c282b05120ba4b698b1a1e9d68af4131>:0
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <e2a51596e3434d12a5bd106b9a0f0644>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <e2a51596e3434d12a5bd106b9a0f0644>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <e2a51596e3434d12a5bd106b9a0f0644>:0
at (wrapper dynamic-method) System.Object.6(intptr,intptr)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Force finishing activity com.comp.myapp/md5ac266b5641403f314bbc23831457c9e5.MainActivity
这个崩溃似乎发生在我的应用程序运行OnCreate()
方法之前,因为我没有找到我在LogCat中通过Log.Debug()
登录的内容。
当我直接启动它时,我的应用程序没有问题。在该状态下,从其他应用程序获取意图并对其进行适当处理也没有问题。
事实证明我的OnCreate方法没有启动,因为它是:
async public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
代替
async protected override void OnCreate(Bundle savedInstanceState)
{