0 down vote accept I've managed to fix it. These are the exact steps I took:
- Duplicate all of the content into a new project manually. DO NOT use the option to create a project from an existing source. - Go to the project properties, and remove the android.jar from the build path. - Save - Add the jar back manually, making sure that it is for the same version of Android as before. It should work now. I tried the above steps on both the original project and one which I created from it's source, and they didn't work. I don't know how or why it works, but I know it does. FWIW, I'm using ADT 18, with SDK tools 19 and platform tools 11. On Sun, Jun 24, 2012 at 12:40 AM, Raghav Sood <raghavs...@gmail.com> wrote: > Hi all, > > I've been having some trouble with a NoClassDefFound exception recently. > The details are below (Copy pasted from StackOverflow, > http://stackoverflow.com/q/11171726/1069068): > > <so> > I've been working on a game for a few months now, and have suddenly > encountered a problem. > > Since yesterday, I have been getting a NoClassDefFound error. There have > been no code changes at all. It was working at night, and wasn't in the > morning. No change at all. Here is the exact stacktrace: > > 06-23 23:12:19.746: E/ACRA(29146): Blue Boy fatal error : > com.appaholics.blueboy.BlueBoy > 06-23 23:12:19.746: E/ACRA(29146): java.lang.NoClassDefFoundError: > com.appaholics.blueboy.BlueBoy > 06-23 23:12:19.746: E/ACRA(29146): at > com.appaholics.blueboy.LoadingScreen.loadTextures(LoadingScreen.java:125) > 06-23 23:12:19.746: E/ACRA(29146): at > com.appaholics.blueboy.LoadingScreen.load(LoadingScreen.java:85) > 06-23 23:12:19.746: E/ACRA(29146): at > com.appaholics.blueboy.LoadingScreen.onCreate(LoadingScreen.java:40) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.Activity.performCreate(Activity.java:4465) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.ActivityThread.access$600(ActivityThread.java:123) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) > 06-23 23:12:19.746: E/ACRA(29146): at > android.os.Handler.dispatchMessage(Handler.java:99) > 06-23 23:12:19.746: E/ACRA(29146): at > android.os.Looper.loop(Looper.java:137) > 06-23 23:12:19.746: E/ACRA(29146): at > android.app.ActivityThread.main(ActivityThread.java:4424) > 06-23 23:12:19.746: E/ACRA(29146): at > java.lang.reflect.Method.invokeNative(Native Method) > 06-23 23:12:19.746: E/ACRA(29146): at > java.lang.reflect.Method.invoke(Method.java:511) > 06-23 23:12:19.746: E/ACRA(29146): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) > 06-23 23:12:19.746: E/ACRA(29146): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) > 06-23 23:12:19.746: E/ACRA(29146): at > dalvik.system.NativeStart.main(Native Method) > > The method in which the exception occurs: > > private void loadTextures() { > BlueBoy.sTextures = new HashMap<String,TextureRegion>(); > BlueBoy.sTiledTextures = new HashMap<String,TiledTextureRegion>(); > BlueBoy.sTextureHolders = new ArrayList<Texture>(); > BlueBoy.sHitVoiceSounds = new Sound[4]; > BlueBoy.sHitSounds = new Sound[4]; > BlueBoy.sWinSounds = new Sound[8]; > BlueBoy.sLoseSounds = new Sound[4]; > Texture texture; > TextureRegionFactory.setAssetBasePath("gfx/"); > BufferObjectManager.setActiveInstance(new BufferObjectManager()); > } > > However, the class BlueBoy definitely exists. To make absolutely sure, I > have taken to decompiling my own app's classes.dex. I have decompiled both > the one generated while making the .apk and the on in the .apk itself. The > class is present in both of them. It is also present in > /bin/classes/com/appaholics/blueboy/. When decompiled, I can see the full > source of the class, as it should be. > > I have tried everything I could think of and find on the net to fix it. I > have: > > > - Done a Clean Build on it > - Created a new project from source in eclipse > - Created a new project and manually shifted everything to it > - Tried renaming the class > - Tried renaming the package > - Tried compiling it from the command line > - Tried cleaning it from the command line > > > All of the other projects in the workspace work fine. > > Other classes like the splash screen and loading screen, which are > launched before BlueBoy work fine. Android can find them. > > Does anybody have any idea as to why this would happen? The class is > exists as surely as I exist, but Android disagrees. > > EDIT: As per duffymo's suggestion, I check the class path for the > existence of this class by adding the following to my splash screen: > > try { > Class.forName("com.appaholics.blueboy.BlueBoy", false, null); > } catch (ClassNotFoundException e1) { > Log.d("ClassCheck", "Not found."); > e1.printStackTrace(); > } > > I get the Not Found message in the LogCat. Now that we know that the class > isn't there in the classpath, how do I fix it? The class is in the same > package as the splash screen and loading class, and both of those are > present. What could cause this one class to not be there, and how could I > fix it? > > EDIT2: FWIW, System.getProperties("java.class.path"); returns ".". > </so> > > Since then I've created an absolutely new activity, and moved the code to > that, and it still crashes with the same exception. All references were > changed. > > -- > Raghav Sood > Please do not email private questions to me as I do not have time to > answer them. Instead, post them to public forums where others and I can > answer and benefit from them. > http://www.appaholics.in/ - Founder > http://www.apress.com/9781430239451 - Author > +91 81 303 77248 > -- Raghav Sood Please do not email private questions to me as I do not have time to answer them. Instead, post them to public forums where others and I can answer and benefit from them. http://www.appaholics.in/ - Founder http://www.apress.com/9781430239451 - Author +91 81 303 77248 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en