Search code examples
javaandroidnoclassdeffounderrordalvikdex

NoClassDefFound error after adding JARs to Android project


I've been looking around the internet for hours now on how to solve this issue. There are many people who posted this on StackOverflow and many other websites but none of the solutions worked for me. I think that many of them are outdated.

Here is what I've tried:

  • Putting the libraries in libs/ and letting the project automatically handle them (Add them as a reference, convert with Dalvik, etc)
  • Adding them like I would for a normal Java project using Build Path settings (Add external jars-->Go to order and export-->Check the checkbox for all jars)
  • I tried the last step but without checking their checkboxes
  • I even tried someone's suggestion to put them in the assets/ folder
  • I tried putting them in the libs/ folder and adding them as internal jars in Build Path settings
  • Deleting bin/-->Cleaning-->Rebuilding ...And much more

I'm guessing my issue is when I am deploying my app, the jars aren't being packaged in the apk like they are supposed to. I am using many different jars. I'm trying to use jReddit and it has A LOT of dependencies.

P.S. Also, there are several solutions that I tried but I didn't mention because when I went to run the program, they caused a Dex Loader error. I also tried many things to remove this problem as well but then it caused the NoClassDefFound error all over again.

Edit: Just wanted to mention that I am using Eclipse.


Solution

  • The solution was switching to another IDE. Eclipse is no longer supported by Google for android development and this is probably why I was having this issue. I switched to Android Studio and it worked. Thanks joaquin!