0

我正在开发一个已经工作了一段时间的应用程序。最近,我不是在打开应用程序时收到错误消息,而是在第一次安装时收到错误消息。日志 cat 显示致命错误 (NPE),然后应用程序自行重启,一切正常。但我担心发生了一些我需要担心的事情。日志猫如下

07-30 08:09:01.060: W/dalvikvm(6469): threadid=1: thread exiting with uncaught          exception (group=0x4136e2a0)
07-30 08:09:01.060: E/AndroidRuntime(6469): FATAL EXCEPTION: main
07-30 08:09:01.060: E/AndroidRuntime(6469): java.lang.RuntimeException: Unable to    instantiate application android.app.Application: java.lang.NullPointerException
07-30 08:09:01.060: E/AndroidRuntime(6469):     at        android.app.LoadedApk.makeApplication(LoadedApk.java:501)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4198)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at  android.app.ActivityThread.access$1300(ActivityThread.java:140)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at    android.os.Looper.loop(Looper.java:137)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.ActivityThread.main(ActivityThread.java:4895)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at java.lang.reflect.Method.invokeNative(Native Method)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at java.lang.reflect.Method.invoke(Method.java:511)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at   com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at dalvik.system.NativeStart.main(Native Method)
07-30 08:09:01.060: E/AndroidRuntime(6469): Caused by: java.lang.NullPointerException
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
07-30 08:09:01.060: E/AndroidRuntime(6469):     at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
07-30 08:09:01.060: E/AndroidRuntime(6469):     ... 11 more
07-30 08:09:09.709: E/SensorManager(6554): thread start

和清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rte"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/rcr6"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" android:logo="@drawable/rcr6">
    <activity
        android:name="com.rte.MainActivity"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>      
    <activity
        android:name="com.rte.SettingsActivity"
        android:label="@string/title_activity_settings" >
    </activity>
    <activity
        android:name="com.rte.About"
        android:label="@string/title_activity_about" >
    </activity>
</application>

任何帮助是极大的赞赏。

4

1 回答 1

1

对于任何阅读本文可能有类似问题的人,可以在此处找到答案

RuntimeException:无法实例化应用程序

如果这不是你想要的,试试这里

当我从 Eclipse 运行我的应用程序时出现异常

于 2013-08-01T17:32:16.937 回答