本文介绍了Android的logcat的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我什么是这背后运行时错误的原因是什么?

 了java.lang.RuntimeException:java.lang.InstantiationException:无法实例活动ComponentInfo产生的原因

我试图做出以下在GitHub上乔Blough的Andr​​oid PDF浏览器库中的PDF阅读器应用程序:的。我也跟着一切,我结束了这个错误。

  3月12日至二十○日:43:14.037:E / AndroidRuntime(29822):了java.lang.RuntimeException:无法实例活动ComponentInfo {com.traininghandouts.app/com.traininghandouts。 app.PdfViewer}:java.lang.InstantiationException:com.traininghandouts.app.PdfViewer
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.os.Handler.dispatchMessage(Handler.java:99)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.os.Looper.loop(Looper.java:123)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread.main(ActivityThread.java:4627)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在java.lang.reflect.Method.invokeNative(本机方法)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在java.lang.reflect.Method.invoke(Method.java:521)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在dalvik.system.NativeStart.main(本机方法)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):java.lang.InstantiationException:产生的原因com.traininghandouts.app.PdfViewer
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在java.lang.Class.newInstanceImpl(本机方法)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在java.lang.Class.newInstance(Class.java:1429)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.Instrumentation.newActivity(Instrumentation.java:1021)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
3月12日至20日:43:14.037:E / AndroidRuntime(29822):... 11个


这是我的code:

  {尝试
  字符串路径=MNT / SD卡/ Android的Andr​​oid的UI设计,patterns.pdf  意向意图=新意图(这一点,PdfViewer.class);
  intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME,路径);
  startActivity(意向);
}赶上(例外五){
   e.printStackTrace();
}


解决方案

InstantiationException:

That came from The Docs

I can't say what EXACTLY caused your exception, but if you post the entirety of the error from Logcat and the line where the exception happens, or a block of code where the exception happens, that may help a little more.

这篇关于Android的logcat的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 00:50
查看更多