如何解决此java.lang.RuntimeException?
Google开发者控制台显示,我的应用程序在过去一个月里收到了两个相同的错误,但是这个如何解决此java.lang.RuntimeException?,java,android,runtimeexception,Java,Android,Runtimeexception,Google开发者控制台显示,我的应用程序在过去一个月里收到了两个相同的错误,但是这个运行时异常没有指定错误源的类或文件。我看不出有什么特别的。以下是两种不同设备的错误: 三星Galaxy S8 Active(Cruiserltett),4096MB内存,安卓7.0 第1/2号报告 java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2984
运行时异常
没有指定错误源的类或文件。我看不出有什么特别的。以下是两种不同设备的错误:
三星Galaxy S8 Active(Cruiserltett),4096MB内存,安卓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内存,安卓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文件,就像我能够解决的其他错误一样
如果有人能帮我解决这个问题,我将不胜感激,
非常感谢。根据,在ActivityThread.performLaunchActivity
中有两个地方抛出了RuntimeException
。它们是:
} catch (Exception e) {
if (!mInstrumentation.onException(activity, e)) {
throw new RuntimeException(
"Unable to instantiate activity " + component
+ ": " + e.toString(), e);
}
}
及
如你所见:
- 它们都为
提供一条消息,其中包括来自原始异常的异常消息RuntimeException
- 它们都将原始异常(
)传递给e
构造函数,以便将其正确链接RuntimeException
除此之外,我可以建议您,尝试诊断此类问题的最佳方法是查看Android源代码。(这在这里不是很有帮助……但是如果您缺少诊断信息的话,情况会更好。)大多数情况下,您会在日志中发现另一个异常。请不要忽略这一点。@greenapps没有遗漏任何内容,我已经提供了所有内容,并在我的帖子中明确说明了这一点。'This
RuntimeException
没有指定错误源于的类或文件'。是的。类是RuntimeException
,文件是ActivityThread.java
,为了更好地衡量,行号是2984。您解决过这个问题吗?我偶尔也会在我的一个应用程序中看到它。但我似乎无法在我的模拟器或设备上重现这个问题。您是否设法解决了这个问题,或者至少知道问题的来源?我有同样的情况:|
} catch (Exception e) {
if (!mInstrumentation.onException(activity, e)) {
throw new RuntimeException(
"Unable to start activity " + component
+ ": " + e.toString(), e);
}
}