Android的logcat的错误 [英] Android Logcat error

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

问题描述

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

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

我试图做出以下在GitHub上乔Blough的Andr​​oid PDF浏览器库中的PDF阅读器应用程序:的 https://github.com/jblough/Android-Pdf-Viewer-Library 。我也跟着一切,我结束了这个错误。

  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:


  当程序试图访问一个构造函数是没有抛出


  从其中参考由所述位置访问


的文档来

我不能说究竟是什么导致你的异常,但如果你从张贴在logcat中错误并在异常情况发生线路,或code在异常情况发生的一个块的整体,这可能帮助多一点。

Anyone can tell me what's the reason behind this run-time error?

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo Caused by: java.lang.InstantiationException

i'm trying to make a PDF reader app following Joe Blough's Android PDF Viewer library at GitHub: https://github.com/jblough/Android-Pdf-Viewer-Library. I followed everything and I end up with this error.

12-20 03:43:14.037: E/AndroidRuntime(29822): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.traininghandouts.app/com.traininghandouts.app.PdfViewer}: java.lang.InstantiationException: com.traininghandouts.app.PdfViewer
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.os.Looper.loop(Looper.java:123)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread.main(ActivityThread.java:4627)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at java.lang.reflect.Method.invokeNative(Native Method)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at java.lang.reflect.Method.invoke(Method.java:521)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at dalvik.system.NativeStart.main(Native Method)
12-20 03:43:14.037: E/AndroidRuntime(29822): Caused by: java.lang.InstantiationException: com.traininghandouts.app.PdfViewer
12-20 03:43:14.037: E/AndroidRuntime(29822):    at java.lang.Class.newInstanceImpl(Native Method)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at java.lang.Class.newInstance(Class.java:1429)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-20 03:43:14.037: E/AndroidRuntime(29822):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-20 03:43:14.037: E/AndroidRuntime(29822):    ... 11 more


here's my code:

try{
  String path =  "mnt/sdcard/android-android-ui-design-patterns.pdf";

  Intent intent = new Intent(this, PdfViewer.class);
  intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
  startActivity(intent);


}catch(Exception e){
   e.printStackTrace();
}

解决方案

InstantiationException:

Thrown when a program attempts to access a constructor which is not accessible from the location where the reference is made.

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的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆