首页 > 移动平台 > 详细

android启动时报错Unable to instantiate application xxxx:java.lang.NullPointerException

时间:2014-06-27 19:08:25      阅读:809      评论:0      收藏:0      [点我收藏+]

如果程序已经运行,再安装到手机的时候总是报以下错误。而且是在打开特定的Activity的情况下才会报错。

06-26 09:45:16.971: E/AndroidRuntime(29733): java.lang.RuntimeException: Unable to instantiate application com.css.promotiontool.ui.CSSAppliction: java.lang.NullPointerException
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.LoadedApk.makeApplication(LoadedApk.java:508)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4245)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.ActivityThread.access$1400(ActivityThread.java:131)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.os.Looper.loop(Looper.java:137)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.ActivityThread.main(ActivityThread.java:4866)
06-26 09:45:16.971: E/AndroidRuntime(29733): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 09:45:16.971: E/AndroidRuntime(29733): at java.lang.reflect.Method.invoke(Method.java:511)
06-26 09:45:16.971: E/AndroidRuntime(29733): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-26 09:45:16.971: E/AndroidRuntime(29733): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-26 09:45:16.971: E/AndroidRuntime(29733): at dalvik.system.NativeStart.main(Native Method)
06-26 09:45:16.971: E/AndroidRuntime(29733): Caused by: java.lang.NullPointerException
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:384)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.LoadedApk.getClassLoader(LoadedApk.java:327)
06-26 09:45:16.971: E/AndroidRuntime(29733): at android.app.LoadedApk.makeApplication(LoadedApk.java:500)
06-26 09:45:16.971: E/AndroidRuntime(29733): ... 11 more

这个问题困扰了好久,网上也查了好多次,但是都没有解决问题。最后从引用资源文件入手,发现是特定的activity标签下引用了资源文件:

<activity
android:name=xxxx
android:label="@string/app_name"/>

删掉引用资源文件就可以了,由于时间问题具体原因未深究。

android启动时报错Unable to instantiate application xxxx:java.lang.NullPointerException,布布扣,bubuko.com

android启动时报错Unable to instantiate application xxxx:java.lang.NullPointerException

原文:http://www.cnblogs.com/toronto/p/3809650.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!