1

I am not really sure why I am getting this NoClassDefFoundError:

java.lang.NoClassDefFoundError: com.google.gson.Gson

I have the gson 2.2 library referenced in the Java Build Path. And the class has imported fine (well not really, but autocomplete works.)

My targetSdk is level 15 and the minSdk is 8.

Any ideas?

Do I need an older version of gson maybe? Should I post the code? Not really sure it is necessary, because Eclipse does not note any errors and the autocompletion works.

Thank you.

EDIT: Wish I could +1 you for that comment JoxTraex. That was it. What I had to do was the answer on this post here. Thanks a lot Jox.

Community
  • 1
  • 1
sjensen85
  • 150
  • 1
  • 2
  • 9
  • 2
    This means that the jar files are not being compiled with the end result apk that you are creating. I am facing a similar issue at my question http://stackoverflow.com/questions/13327917/building-an-android-library-project-with-jar-dependencies . One way you can verify this is decompiling your APK using apktool: http://code.google.com/p/android-apktool/ and then look at your result and see if the classes are there. – JoxTraex Nov 11 '12 at 02:08
  • Hi, You can post sample code which shows the error. I can solve your problem in your program – RajeshVijayakumar Nov 11 '12 at 02:32
  • see [this post](http://stackoverflow.com/questions/6947284/android-and-gson) maybe you import gson library incorrectly. – Misagh Aghakhani Dec 27 '12 at 10:43

1 Answers1

3

This means that the jar files are not being compiled with the end result apk that you are creating.

JoxTraex
  • 13,423
  • 6
  • 32
  • 45