Google Developer Console显示我的应用在过去一个月内收到了两个相同的错误,但此RuntimeException
并未指定错误源自的类或文件。我没看到具体的东西。以下是两个不同设备的错误:
三星Galaxy S8 Active(cruiserlteatt),4096MB RAM,Android 7.0 报告1的2
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2984)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3045)
at android.app.ActivityThread.handleRelaunchActivity
(ActivityThread.java:4978)
at android.app.ActivityThread.-wrap21 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1648)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6781)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
三星Galaxy S7(heroqltespr),4096MB RAM,Android 7.0 报告2的2
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2947)
at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:3008)
at android.app.ActivityThread.handleRelaunchActivity
(ActivityThread.java:4974)
at android.app.ActivityThread.-wrap21 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1656)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6688)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
导致此错误的原因是什么?这是它发生的唯一两次,并且提供的日志没有像我能够解决的其他错误一样显示java类或xml文件。
如果有人可以帮我解决这个问题,我将不胜感激, 非常感谢。
答案 0 :(得分:2)
根据the source code,ActivityThread.performLaunchActivity
中有两个地方投放RuntimeException
。他们是:
} catch (Exception e) {
if (!mInstrumentation.onException(activity, e)) {
throw new RuntimeException(
"Unable to instantiate activity " + component
+ ": " + e.toString(), e);
}
}
和
} catch (Exception e) {
if (!mInstrumentation.onException(activity, e)) {
throw new RuntimeException(
"Unable to start activity " + component
+ ": " + e.toString(), e);
}
}
如你所见:
RuntimeException
提供了一条消息,其中包含原始异常的异常消息。e
)传递给RuntimeException
构造函数,以便正确链接。如果没有因果异常消息(至少)和因果异常堆栈跟踪,或者您的完整应用源代码,则几乎不可能诊断您的问题。
您需要弄清楚如何让Google Developer Console为您提供缺失的信息,或者获取logcat来记录它们。 如果没有遗漏信息,我们无法帮助您。
除此之外,我可以告诉您,尝试诊断此类问题的最佳方法是查看Android源代码。 (这在这里不是很有用......但是如果你有缺少的诊断信息就会出现这种情况。)