2

enter image description hereI 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.

Community
  • 1
  • 1
Phix
  • 9,364
  • 4
  • 35
  • 62
  • 1
    Have you tried not putting it in Libraries, but only in libs? – kabuko Nov 08 '12 at 22:52
  • Try **either** add external jar to build path, **or** put in libs folder, do not use both at the same time. – yorkw Nov 09 '12 at 00:47
  • Starting from scratch, trying both of those, still no dice. I recreated the jar, thinking there was something there too, but no. Nada. Brand new fancy clean Android project, even went as far as adding the `android-support-v4` jar which works. I can see all my classes in the **Android Dependencies** directory and all! – Phix Nov 09 '12 at 07:33

1 Answers1

5

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!

Phix
  • 9,364
  • 4
  • 35
  • 62