GeekedOut
GeekedOut

Reputation: 17185

Android - exception when compiling and running the application

I am running a debug android application with eclipse and the simulator, and on a restarting of the app, I get this exception,

03-23 02:19:51.384: E/AndroidRuntime(605): FATAL EXCEPTION: main
03-23 02:19:51.384: E/AndroidRuntime(605): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.ActivityThread.access$1300(ActivityThread.java:123)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.os.Looper.loop(Looper.java:137)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.ActivityThread.main(ActivityThread.java:4424)
03-23 02:19:51.384: E/AndroidRuntime(605):  at java.lang.reflect.Method.invokeNative(Native Method)
03-23 02:19:51.384: E/AndroidRuntime(605):  at java.lang.reflect.Method.invoke(Method.java:511)
03-23 02:19:51.384: E/AndroidRuntime(605):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-23 02:19:51.384: E/AndroidRuntime(605):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-23 02:19:51.384: E/AndroidRuntime(605):  at dalvik.system.NativeStart.main(Native Method)
03-23 02:19:51.384: E/AndroidRuntime(605): Caused by: java.lang.NullPointerException
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
03-23 02:19:51.384: E/AndroidRuntime(605):  at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
03-23 02:19:51.384: E/AndroidRuntime(605):  ... 11 more

But this doesn't really say where the error happened in my code. Any idea why this might be happening and how to prevent it?

and this is the entire manifest of the small application:

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

    <uses-sdk android:minSdkVersion="15" />

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".ProblemioActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name=".AddProblemActivity"
            android:label="@string/add_problem" />

        <activity
            android:name=".LoginActivity"
            android:label="@string/login" />        

        <activity
            android:name=".MyProblemsActivity"
            android:label="@string/your_problems" /> 

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

        <activity
            android:name=".CreateProfileActivity"
            android:label="@string/create_account" />         

        <activity
            android:name=".ProblemActivity"
            android:label="@string/problem_page_header" />   

        <activity
            android:name=".SuggestSolutionActivity"
            android:label="@string/suggest_solution_header" />  

        <activity
            android:name=".SuggestedSolutionActivity"
            android:label="@string/suggested_solution_header" />          

        <activity
            android:name=".ViewSolutionsActivity"
            android:label="@string/view_solutions_header" />        

        <activity
            android:name=".TopicActivity"
            android:label="@string/topic_header" /> 

    </application>

</manifest>

Thanks!

Upvotes: 0

Views: 1558

Answers (2)

GeekedOut
GeekedOut

Reputation: 17185

The real solution to this problem is a folder permissions issue. Make sure you are operating in a folder that you can modify. I just fixed that same problem for my self by making sure I was in a folder with the right permissions.

Upvotes: 0

hotpro
hotpro

Reputation: 336

I also get this excepiton. I am using Nexus S, and update to 4.0.3 I just ignore this exception.

Upvotes: 1

Related Questions