LogCat输出Null Pointer Exceptions,但应用程序没有崩溃

时间:2013-06-11 21:55:59

标签: android nullpointerexception logcat android-logcat

启动我的应用时,我的LogCat填满了这个

06-11 23:51:51.635: E/AndroidRuntime(29950): FATAL EXCEPTION: main
06-11 23:51:51.635: E/AndroidRuntime(29950): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4201)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.ActivityThread.access$1300(ActivityThread.java:140)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.os.Looper.loop(Looper.java:137)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.ActivityThread.main(ActivityThread.java:4898)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at java.lang.reflect.Method.invokeNative(Native Method)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at java.lang.reflect.Method.invoke(Method.java:511)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at dalvik.system.NativeStart.main(Native Method)
06-11 23:51:51.635: E/AndroidRuntime(29950): Caused by: java.lang.NullPointerException
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
06-11 23:51:51.635: E/AndroidRuntime(29950):    at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
06-11 23:51:51.635: E/AndroidRuntime(29950):    ... 11 more

清单(添加清单,就像你问的那样)

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

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

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="eu.hantaro.www.permission.MAPS_RECEIVE" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />



    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/spui" >
        <activity
            android:name="eu.hantaro.www.SplashScreen"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity 
            android:name="eu.hantaro.www.FavoriteActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.lightTimesActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.MainActivity"
            android:screenOrientation="portrait">
        </activity>

        <activity 
            android:name="eu.hantaro.www.buildingDetailsActivity"
            android:screenOrientation="portrait">            
        </activity>


        <activity 
            android:name="eu.hantaro.www.SettingsActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.SubbuildingActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.Addbuilding"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.lightSettingsActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.DirectionActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.SearchAddressActivity"
            android:screenOrientation="portrait">            
        </activity>

        <activity 
            android:name="eu.hantaro.www.tutorialActivity"
            android:screenOrientation="portrait">            
        </activity>

          <activity 
            android:name="eu.hantaro.www.tutorialContentActivity"
            android:screenOrientation="portrait">            
        </activity>

         <activity 
            android:name="eu.hantaro.www.SharedPref"
            android:screenOrientation="portrait">            
        </activity>

          <activity 
            android:name="eu.hantaro.www.buildingList"
            android:screenOrientation="portrait">            
        </activity>


        <service android:name="eu.hantaro.www.lightTimeService" />
        <service android:name="eu.hantaro.www.NotificationF" />
        <service android:name="eu.hantaro.www.NotificationD" />
        <service android:name="eu.hantaro.www.NotificationA" />
        <service android:name="eu.hantaro.www.NotificationM" />
        <service android:name="eu.hantaro.www.NotificationI" />
        <service android:name="eu.hantaro.www.RingerModeSilent" />
        <service android:name="eu.hantaro.www.RingerModeNormal" />

        <uses-library android:name="com.google.android.maps" />
    </application>    
</manifest>

但是应用程序没有崩溃,一切都运转良好。我的LogCat向我投掷的东西是什么意思?

1 个答案:

答案 0 :(得分:3)

查看ICS源代码 - 似乎无论出于何种原因,程序包管理器无法获取您的程序包信息 - 它可能只是一个eclipse / ADT错误,其中eclipse对文件持有某种锁定,但无论如何是的,它似乎不是你的代码可能导致的东西。我建议运行一个干净的,从模拟器/设备卸载应用程序,或者如果这些不起作用,你可以尝试一个新的eclipse工作区。

另一个可能是问题的问题是,如果你正在使用一个图书馆项目 - 尝试取消链接这两个项目,清理,然后再将它们重新连接起来 - 但这就是我的行李诀窍:)