ClassNotFoundException after upgrading to ADT 18

adt, android, classnotfoundexception, eclipse

Solution

Put your externals jars in libs directory. You can take a look at this link

Problem

Since I updated ADT to 19, I started to get following error. The problem happens whenever I start my apps. I checked all the previous post related to this, but it seems none of them helps. any idea would be GREATLY appreciated... My setup - I currently have ADT 18, SDK 19, elcipse in Windows 7 64bit. - I use library project which makes ashare.jar and all my external jars (i.e. dropbox, commons codec) are in "libs" folder in Library project (Ashare). - I don't use proguard. How we see this problem. - Create apk in eclipse > {MyProject} > Right click > Android Tools > Export signed application package - install the apk in emulator or dev.phone using "adb install XXX.apk" - Start the app. Then, BOOM. it throw the error. Some noticeable things are - It started to happen after I updated to ADT in my eclipse to version 18 - It happens only when I make signed apk and run it in emulator or dev.phone. - I don't see problem if I run my app using {MyProject} > Right click > Run As > Android Application - When I checked inside of classes.dex, I see some classes are missing there. I am not sure, but I feel Build process is not including all classes in classes.dex - During the export, there's no error in eclipse console (I use verbose option in Android>Build>Build output setting) Java Exception ``` 05-07 08:52:48.336: D/AndroidRuntime(3055): Shutting down VM 05-07 08:52:48.336: W/dalvikvm(3055): threadid=1: thread exiting with uncaught exception (group=0x40a3e1f8) 05-07 08:52:48.340: E/AndroidRuntime(3055): FATAL EXCEPTION: main 05-07 08:52:48.340: E/AndroidRuntime(3055): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.acj0.barcodeexpdemo/com.acj0.barcodeexpdemo.Launcher}: java.lang.ClassNotFoundException: com.acj0.barcodeexpdemo.Launcher 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread.access$600(ActivityThread.java:123) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.os.Handler.dispatchMessage(Handler.java:99) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.os.Looper.loop(Looper.java:137) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-07 08:52:48.340: E/AndroidRuntime(3055): at java.lang.reflect.Method.invokeNative(Native Method) 05-07 08:52:48.340: E/AndroidRuntime(3055): at java.lang.reflect.Method.invoke(Method.java:511) 05-07 08:52:48.340: E/AndroidRuntime(3055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 05-07 08:52:48.340: E/AndroidRuntime(3055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 05-07 08:52:48.340: E/AndroidRuntime(3055): at dalvik.system.NativeStart.main(Native Method) 05-07 08:52:48.340: E/AndroidRuntime(3055): Caused by: java.lang.ClassNotFoundException: com.acj0.barcodeexpdemo.Launcher 05-07 08:52:48.340: E/AndroidRuntime(3055): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 05-07 08:52:48.340: E/AndroidRuntime(3055): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 05-07 08:52:48.340: E/AndroidRuntime(3055): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 05-07 08:52:48.340: E/AndroidRuntime(3055): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 05-07 08:52:48.340: E/AndroidRuntime(3055): ... 11 more ``` UPDATE 5/7/2012 - All my jars are in "libs" folder of Library project and I see all of them included in "Android Dependencies" UPDATE 5/18/2012 - TEMPORARILY SOLVED - I found temporary solution. Right before running "Export signed application package", I did "Clean" WITHOUT "build automatically" option checked. Then, I don't see the error anymore. I don't know why it works. If you have any idea, please let me know.

Original source

Related problems