Class (an Activity) is declared but ClassNotFoundException still occurs

115 Views Asked by At

I've tried to fix this issue for long time but still being stuck. I already declared my Activity in AndroidManifest.xml file but ActivityNotFoundException still occurs, Please help!

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sel.appsinfo" >

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyAppTheme" >
    <activity
        android:name="com.sel.appsinfo.AppsInfoMainActivity"
        android:uiOptions="splitActionBarWhenNarrow" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Logcat:

08-05 23:37:17.566: W/dalvikvm(26899): Unable to resolve superclass of Lcom/sel/appsinfo/BaseActivity; (85)
08-05 23:37:17.567: W/dalvikvm(26899): Link of class 'Lcom/sel/appsinfo/BaseActivity;' failed
08-05 23:37:17.568: W/dalvikvm(26899): Unable to resolve superclass of Lcom/sel/appsinfo/AppsInfoMainActivity; (166)
08-05 23:37:17.568: W/dalvikvm(26899): Link of class 'Lcom/sel/appsinfo/AppsInfoMainActivity;' failed
08-05 23:37:17.571: D/AndroidRuntime(26899): Shutting down VM
08-05 23:37:17.571: W/dalvikvm(26899): threadid=1: thread exiting with uncaught exception (group=0x40c97258)
08-05 23:37:17.574: E/AndroidRuntime(26899): FATAL EXCEPTION: main
08-05 23:37:17.574: E/AndroidRuntime(26899): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sel.appsinfo/com.sel.appsinfo.AppsInfoMainActivity}: java.lang.ClassNotFoundException: com.sel.appsinfo.AppsInfoMainActivity
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2023)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1174)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.os.Looper.loop(Looper.java:137)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread.main(ActivityThread.java:4503)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at java.lang.reflect.Method.invokeNative(Native Method)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at java.lang.reflect.Method.invoke(Method.java:511)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at dalvik.system.NativeStart.main(Native Method)
08-05 23:37:17.574: E/AndroidRuntime(26899): Caused by: java.lang.ClassNotFoundException: com.sel.appsinfo.AppsInfoMainActivity
08-05 23:37:17.574: E/AndroidRuntime(26899):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
08-05 23:37:17.574: E/AndroidRuntime(26899):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1911)
08-05 23:37:17.574: E/AndroidRuntime(26899):    ... 11 more
5

There are 5 best solutions below

0
On BEST ANSWER

I solved it, It was because of I had so many libs included unnecessary :|

1
On

It looks like AppsInfoMainActivity extends BaseActivity but BaseActivity extends something else which is probably not valid. Make sure it is extending Activity or an AppCompat Activity class and that the imports are correct

Make sure your Intent Filter tag in the XML which contains MAIN also contains

<category android:name="android.intent.category.DEFAULT" />
0
On

If it's extending Activity or an AppCompat Activity class and that the imports are right, maybe 2 versions of android-support-v4.jar in the dependency list, but not all the versions are identical (check is based on SHA-1 only at this time). All must be the same.

0
On

Hmm Maybe cleaning Project will help.

0
On

I think there's a problem about your class path. Please check class path and if it's wrong correct it.