Android app not starting after upgrade of Eclipse to Juno (ClassNotFound)

I've recently upgrade Eclipse to the Juno release and every thing seemed to be working. After a few weeks (now) I needed to work on the Android app, so I reinstalled the ADT plugin. It required the update of a few related things in the external Android SDK directory. After that things seemed fine.

But as soon as I started the app, both in the emulator and on a test device, the app crashes.

09-10 14:55:14.879: I/ActivityManager(1571): Start proc nl.reinders.android.inventoryapp for activity nl.reinders.android.inventoryapp/.MainMenu: pid=5890 uid=10027 gids={3001, 3002, 3003}
09-10 14:55:14.999: W/dalvikvm(5890): Unable to resolve superclass of Lnl/reinders/android/inventoryapp/MyApplication; (239)
09-10 14:55:14.999: W/dalvikvm(5890): Link of class 'Lnl/reinders/android/inventoryapp/MyApplication;' failed
09-10 14:55:15.009: W/dalvikvm(5890): threadid=1: thread exiting with uncaught exception (group=0x40018560)
09-10 14:55:15.009: E/AndroidRuntime(5890): FATAL EXCEPTION: main
09-10 14:55:15.009: E/AndroidRuntime(5890): java.lang.RuntimeException: Unable to instantiate application nl.reinders.android.inventoryapp.MyApplication: java.lang.ClassNotFoundException: nl.reinders.android.inventoryapp.MyApplication in loader dalvik.system.PathClassLoader[/data/app/nl.reinders.android.inventoryapp-2.apk]
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.LoadedApk.makeApplication(LoadedApk.java:466)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3264)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.ActivityThread.access$2200(ActivityThread.java:117)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.os.Looper.loop(Looper.java:123)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.ActivityThread.main(ActivityThread.java:3729)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at java.lang.reflect.Method.invokeNative(Native Method)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at java.lang.reflect.Method.invoke(Method.java:507)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:632)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at dalvik.system.NativeStart.main(Native Method)
09-10 14:55:15.009: E/AndroidRuntime(5890): Caused by: java.lang.ClassNotFoundException: nl.reinders.android.inventoryapp.MyApplication in loader dalvik.system.PathClassLoader[/data/app/nl.reinders.android.inventoryapp-2.apk]
09-10 14:55:15.009: E/AndroidRuntime(5890):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.Instrumentation.newApplication(Instrumentation.java:942)
09-10 14:55:15.009: E/AndroidRuntime(5890):     at android.app.LoadedApk.makeApplication(LoadedApk.java:461)
09-10 14:55:15.009: E/AndroidRuntime(5890):     ... 11 more
09-10 14:55:15.019: W/ActivityManager(1571):   Force finishing activity nl.reinders.android.inventoryapp/.MainMenu
09-10 14:55:15.529: W/ActivityManager(1571): Activity pause timeout for HistoryRecord{408f7cb0 nl.reinders.android.inventoryapp/.MainMenu}
09-10 14:55:25.649: W/ActivityManager(1571): Activity destroy timeout for HistoryRecord{408f7cb0 nl.reinders.android.inventoryapp/.MainMenu}

Crucial IMHO is that warning "Unable to resolve superclass", which then results in the class itself not being loaded. Weird is that the class is present in Eclipse, it's RoboGuice's Application class (http://code.google.com/p/roboguice/) and its jar is present. I can click it, the class file is opened (unreadable of course, but)...

Coincidentally I still had the old environment (Eclipse Indigo), but it required an update of the ADT plugin because of the upgraded Android SDK, and has the same problem.

Any suggestions why the RoboGuice jar seems to be not included?

Answers


With the newer ADT Plug-in, all external 'jar' files need to be in the libs/ folder (and you don't have to reference them from your project... so you can right click > properties > Java Build Path > Libraries and remove the reference to the JAR file)


Please check if the jar file is included in the build path. All the jars in libs folder are automatically included in the build path, if your file is present elsewhere you have to manually include it in the build path in the project properties.


In Addition to the libs vs lib issue, we seem to be able to get ourselves into this situation by having two versions of eclipse and two SDK folders, and then setting the older eclipse (with an older ADT plugin) to point to the newer SDK folder.

Make sure your ADT is pointing to the intended SDK folder.


Need Your Help

Colorbar in MATLAB placing too many numbers in figure

matlab matlab-figure

I'm trying to make contour map and have been stuck putting a colorbar onto the figure. I am currently using the following code:

JQuery list / link manipulation error in IE7 only

jquery jquery-ui internet-explorer-7 jquery-ui-dialog

I use the following code to find hooks in the html, generate links from them, create and populate popups, and then hide the hooks themselves from view. It works fine in FF, Chrome, Safari, IE8 and ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.