Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException: Didn't find class "com.example.app.MainActivity" for every app I create [closed]

Hello
I keep getting a ClassNotFoundException every time I create an Android application in eclipse. This is something that has never happened before up until this morning after using eclipse for months. It might also be worth mentioning that I installed google play services through the SDK manager this morning

Logcat:

11-03 12:39:29.080: E/AndroidRuntime(27547): FATAL EXCEPTION: main
11-03 12:39:29.080: E/AndroidRuntime(27547): Process: com.example.app, PID: 27547
11-03 12:39:29.080: E/AndroidRuntime(27547): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.app/com.example.app.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.app-1, /vendor/lib, /system/lib]]
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread.access$900(ActivityThread.java:161)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.os.Handler.dispatchMessage(Handler.java:102)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.os.Looper.loop(Looper.java:157)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread.main(ActivityThread.java:5356)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at java.lang.reflect.Method.invokeNative(Native Method)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at java.lang.reflect.Method.invoke(Method.java:515)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at dalvik.system.NativeStart.main(Native Method)
11-03 12:39:29.080: E/AndroidRuntime(27547): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.app-1, /vendor/lib, /system/lib]]
11-03 12:39:29.080: E/AndroidRuntime(27547):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
11-03 12:39:29.080: E/AndroidRuntime(27547):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)



Manifest.xml:

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>



Any help with this would be really appreciated as I am at a loss with it.



eclipse:
enter image description hereenter image description here

like image 347
Paul Alexander Avatar asked Nov 01 '22 14:11

Paul Alexander


1 Answers

Open your AndroidManifest.xml and check if you have com.example.app.MainActivity :

    <activity
        android:name="com.example.app.MainActivity"
        android:label="@string/app_name" >
    </activity>
like image 160
Blaze Tama Avatar answered Nov 13 '22 06:11

Blaze Tama