Noclassdeffounderror - Eclipse and Android

Eclipse Android java.lang.NoClassDefFoundError

It seems the same error that in this question, that is fixed Adding libraries with resources of this tutorial.

NoClassDefFoundError in Eclipse

Try this:

Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.

Hope this helps.

java.lang.NoClassDefFoundError in eclipse

Check your Project Settings. In Java Build Path --> Order and Export Tab - Android Private Libraries and Android Dependency Should be checked.

Android and Eclipse - java.lang.NoClassDefFoundError with project dependency

You need to mark your "template project" as an Android library project. Go to Project->Properties->Android and checked the "is library".

NoClassDefFoundError while executing Android JUnit test

I found the solution. But it's actually some kind of workaround because I can't image that I usually need to tinker like this (maybe someone knows a better solution?):

My main project is a Maven project, in this project I have to set configured the output folders from /bin... to /target/classes, target/test-classes and target/generated-sources. I've done that because otherwise my JUnit tests from main project would not find the latest code changes as long as I do not run mvn install.. If the output folders are target/..., I don't need to run mvn install to have the latest changes in my tests.

The problem is now that the Android test project doesn't find the compiled sources when they are stored in main project's target. When I set the output folder in main project to bin and run mvn install, the Android test project can find the classes now. I have to do this just once. When I set it back to target, both my Android tests still run and my main JUnit tests run. When I change the methods in the main project, the test project immediately recognize the changes, so that means it doesn't use binary jar or something (which is indeed very good, although I don't understand why it finds it now, although I set it back to target?).

[UPDATE]

Adding these two lines to main project's pom to build section solves the issue, so I don't need a workaround anymore.

    <outputDirectory>bin/classes</outputDirectory>
<testOutputDirectory>bin/test-classes</testOutputDirectory>

java.lang.NoClassDefFoundError when trying to run tasks-android-sample

I think you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?



Related Topics



Leave a reply



Submit