Reputation: 9910
I have tried absolutely everything to avoid the NoClassDefFoundError when trying to use an external jar. No dice. WTF ADT?!
From a clean, brand new project, add external jar to build path, put in libs
folder, make sure it's checked. Android -> Fix Project Properties, adding and removing, rinsing and repeating. I checked the contents of the jar, and my files are there! I referenced it 20 ways, removed added and rebuilt, still the dern thing can't be found!!
Is there a way someone has, from step 1, made an external jar work inside Android using eclipse and ADT 20?
Edit 1
I tried adding it into only the libs/
folder, and tried what Ali suggested in this SO question. I think I'm going to have to just try and add the source to my project directly, but that seems plain silly.
Upvotes: 2
Views: 564
Reputation: 9910
Oh. My. Goodness.
Turns out, Android (still) does NOT support Java 7 and when I created my external project, it had the 1.7 (Java 7) as the default compliance level! Switching that down to match my Android project's compliance makes it all dandy.
Stuff like
List<MyClass> mList = new ArrayList<>();
And various @Override
apparently made Android stick it's nose in the air.
Hopefully this helps someone else out who's been going bald over this issue!
Upvotes: 5