i tried various things and the reason for error in my case was conflict between maps.jar and google api in java build path-> libraries. so, when i removed the maps.jar it worked fine.
please make sure your jar file is in the libs directory of your project in you are using newer adt version with your eclipse.
i got the exact same problem ... to fix it, i just removed my android private libs in "build path" and clicked ok ... and when i opened op the "build path" again eclipse had added them by itself again, and then it worked for me ;)...
i spent two days trying to solve this issue after updating adt. finally i was lucky to get this post here:
which led me in the right direction. when you follow the solution - remember to replace the android support library of all your projects to the same version (remove it and re-install it to the projects). i hope this helps - good luck
if you prefer to know which files the workaround is related to here's what i found. simple change the .classpath file to
<?xml version="1.0" encoding="utf-8"?>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.android_framework"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.libraries"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.dependencies"/>
<classpathentry kind="output" path="bin/classes"/>
replace the .classpath file in all library projects and in main android project. the .classpath file is in the root folder of the eclipse project. of cause don't forget to add your own classpath entries, should you have any (so compare with your current version of .classpath).
i believe this is the same result as going through the eclipse menus as componavt-user explained above (eclipse / configure build path / order and export).
the solution here worked for me. it's a matter of importing the library to the libs folder, then modifying the build.gradle file and then cleaning with gradlew.
if you change your order and export in your project build path, this error will not occur. the other way of achieving it is through .classpath in your project folder.
add all the libraries to build pat in eclipse( means make all libraries referenced libraries)
delete r.java file and again build the project. don't worry, r.java will automatically get recreated.
as i understood, your project shows no errors, because you included the jar. but the jar won't be used, when your project got "exported" to the device. try this
project -> properties
java build path / order and export
[✔] your jar
this happens quite very often to me.
last time that happened i can remembered was caused by switching the eclipse adt (google special edition) to android studio, and switching back. i basically tried all methods that i can found on stackoverflow which didn't work for me.
eventually, i got the app working again (no more nocalssdeffounderror) by switching my ide to original eclipse (kepler) with adt.
sometimes you have to take the whole external project as library and not only the jar:
my problem solved by adding the whole project (in my case google-play-services_lib) as library and not only the jar. the steps to to it (from @style answer):
- select android project
- select "create project from existing source"
- click "browse..." button and navigate to the wanted project
- finish (now action bar project in your workspace)
- right-click on your project -> properties
- in android->library section click add
- select recently added project -> ok
sometimes it will happen due to not including jar, which you have dependency, with "uses-libary" tag in your androidmanifest.xml.
also, make sure it should be inside "application" tag.
i had this problem and it was caused by not "exporting" the library.issue was just because the .class files for some classes are not available while packaging the apk.compile time it will work fine with out exporiting
in my case i was using "cusrsoradapter" class and under "javabuildpath->order and export" i didn't check the support v4 jar.once it is selected issue is gone.
to make sure you are getting noclassdeffound error because of above reason, please check your logacat, you will see unknown super classs error at run time.
acutally you have reached the infamous 64k limit issue, you need to enable multidex.
this is how you do it. https://developer.android.com/tools/building/multidex.html
i tried everything from this post (and some other posts), and it didn't worked for me, this is by far the most terrible adt upgrade i have experienced, and i will never upgrade without a working adt backup.
i managed to solve it by removing the project, and then adding it again using a source backup i had.
i had this same error with adt22. resolved it checking "android private libraries" in properties -> java build path -> order and export. if you are using any library projects, the same should be done for them as well.
all the existing answers don't work for me because my case is a little bit different. it took me a few hours to get it to work. i'm using eclipse.
my android project includes another normal java 1.6 project, which needs a 3rd party jar file. the trick is:
- include the jar in the normal java project for it to compile (only), don't check it in the "order and export" tab
- also copy this jar file into the "libs" folder of the android project so it'll be available in runtime
hope this help those who have similar scenarios like mine.
right click your project folder, look for properties in java build path and select the jar files that you see. it has worked for me.
john o'connor is right with the issue. the problem stays with installing adt 17 and above. found this link for fixing the error:
same thing worked for me: properties -> java build path -> "order and export" interestingly - why this is not done automatically? i guess some setting is missing. also this happened for me after sdk upgrade.
i have encountered the same issue. the reason was that the library that i was trying to use had been compiled with a standard jdk 7.
i recompiled it with the
-source 1.6 -target 1.6 options and it worked fine.
i'm not sure if this is related, or if you're even still looking for an answer, but i came across this thread while trying to research the same error (but possibly for different reasons).
i couldn't find any solutions online, but an answer on a similar thread got me thinking and realized i probably just needed to rebuild (or clean) the project.
in eclipse, go to project => clean. select your project and eclipse seemed to fix it itself. for me this solved the problem.
hope this helps.
i have changed the order of included projects (eclipse / configure build path / order and export). i have moved my two dependent projects to the top of the "order and export" list. it solved the problem "noclassdeffounderror".
it is strange for me. i didn't heard about the importance of the order of included libraries and projects. android + eclipse is fun :)
i had this for mapactivity. builds in eclipse gets noclassdeffound in debugger.
forgot to add library to manifest, inside
<uses-library android:name="com.google.android.maps" />
by adding the external jar into your build path just adds the jar to your package, but it will not be available during runtime.
in order for the jar to be available at runtime, you need to:
- put the jar under your
- include this copy of the jar in your build path
- go to the export tab on the same popup window
- check the box against the newly added jar
i didn't have to put the jar-library in assets or lib(s), but only tick the box for this jar in properties -> java build path -> "order and export" (it was listed before, but not selected)
i had this problem after updating adt.
i was storing all of my jar files in a folder called "lib" and adding the jars to the build path the normal eclipse way. this worked fine until my update.
after my update, i was getting the noclassdeffounderror for a class that i could clearly see was included in the jar (checking out the referencedlibraries classes).
the solution was to remove my jars from the build path and rename my "lib" folder to "libs". this is an ant convention, and seems to be the way the new adt finds and includes libraries in an .apk file. once i did this, everything worked fine.
- NoClassDefFoundError - Eclipse and Android
- NoClassDefFoundError developing library with Android app, Maven, and Eclipse
- java servlet project and android library project in eclipse - NoClassDefFoundError
- Eclipse Android and gitignore
- eclipse not showing Avd manager window and android project
- How to use Gradle to generate Eclipse and Intellij project files for Android projects
- Scala, Android and Eclipse
- Android Development Tool 23.0.0 and Android L Update error in eclipse
- Eclipse with android plugin - Blocked at "calculating requirements and dependencies"
- "Selection cannot be launched and there are no recent launches” when Eclipse for Android Project Dev
- Mercurial ignore-file for Eclipse and Android development
- Differences between Android NetBEANS plugin and Eclipse plugin?
- Eclipse and Android SDK issue "aapt.exe has stopped"
- Android Eclipse NoClassDefFoundError for external .jar files
- Using JDK 7 Or Higher With Android Studio And Eclipse On Mac OSX
- What are the differences between android studio and the eclipse version bundled with android SDK
- What is the difference between Eclipse "Import" and "Create project from existing source" for Android projects?
- Eclipse and Android XML layouts gives "'default' is not a best match for any device/locale combination"
- Error with parsing Android sdk content and initializing java tooling in eclipse
- Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
- cannot access memory at address 0X1 after setting up gdb and eclipse to debug shared library from Android Application
- Using ADT and SDK manager, attach android source code to eclipse
- Eclipse IDE - Android Graphical Layout and XML Layout Side by Side
- Why does Android Eclipse constantly refresh external folders and take forver?
- How to create new android project in eclipse and share in local git repository?
- Eclipse Indigo Android ADT - install OK, no "Android" option in Preferences and New Project
- Fixing Eclipse errors when using Android NDK and std::vector
- Android trying to run my project in eclipse and end up with xml.out
- RoboLectric and Android in Eclipse (WARNING: no system properties value for ro.build.date.utc)
- How to properly clone an Android project using Eclipse and Mercurial
More Query from same tag
- Java - special characters in file names
- Eclipse French support
- "Indentation size" disabled in Eclipse XML plugin
- How to disable code completion in Eclipse?
- How to setup PHP CodeSniffer + Formartter profile for CakePHP in Eclipse?
- Getting at XML files inside Android.jar.res.drawable
- Vertical line between matching curly braces for java in eclipse
- Eclipse doesn't generate MainActivity.java & activity_main.xml
- g++ Undefined reference in templated class
- What eclipse version to use for: Java, Python, and Android
- Java EE Query two tables
- Installing a new Glassfish server on Eclipse Indigo
- ANTLR4 project wont display anything in Eclipse
- Eclipse window relocation on Sierra
- Error google-play-services_lib\AndroidManifest.xml not found or not a file with Robolectric 2 and Google Play Services (maps V2)
- Why do I need to copy libraries in lib folder if I define an user library in Eclipse?
- Grayed out option in popupmenu
- Help on Tab Layout example
- GEF EditPartViewer selection
- How can I add a custom file(built for every created project) in Eclipse?
- Running web.xml from Eclipse results in HTTP Status 404
- android.support.v7.widget.GridLayout failed to instantiate
- How to preserve selections in a JFace TableViewer when refreshing?
- Failed to create the part's controls in Eclipse with Salesforce
- How can I open the terminal and run shell commands in custom eclipse plugin like cp or mv?
- Removing Objects From ArrayList Sometimes Not Working
- Speeding up PDE edit-compile-debug cycle
- Eclipse SWT browser and Firebug lite?
- unable to change tomcat url
- How do i create a local CVS repository in Eclipse Helios?