Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何解决此java.lang.RuntimeException?_Java_Android_Runtimeexception - Fatal编程技术网

如何解决此java.lang.RuntimeException?

如何解决此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

Google开发者控制台显示,我的应用程序在过去一个月里收到了两个相同的错误,但是这个
运行时异常
没有指定错误源的类或文件。我看不出有什么特别的。以下是两种不同设备的错误:

三星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
    构造函数,以便将其正确链接
如果没有因果异常消息(至少)和因果异常stacktrace,或者没有完整的应用程序源代码,诊断您的问题几乎是不可能的

你需要弄清楚如何让Google开发者控制台给你丢失的信息,或者让logcat记录它们如果没有丢失的信息,我们将无法帮助您。


除此之外,我可以建议您,尝试诊断此类问题的最佳方法是查看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);
        }
    }