0

I want to write a little program which is able to work with Google tasks. The sample program is working fine.

Now I want to write my own application, but I always get an NoClassDefFoundError.

I tried this solution, but that does not work either.

Stack trace:

04-10 19:40:19.573: E/AndroidRuntime(306): FATAL EXCEPTION: main
    04-10 19:40:19.573: E/AndroidRuntime(306): java.lang.NoClassDefFoundError: com.google.api.client.extensions.android2.AndroidHttp
    04-10 19:40:19.573: E/AndroidRuntime(306):  at org.todo.TodoActivity.<init>(TodoActivity.java:78)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at java.lang.Class.newInstanceImpl(Native Method)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at java.lang.Class.newInstance(Class.java:1429)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.os.Handler.dispatchMessage(Handler.java:99)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.os.Looper.loop(Looper.java:123)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at android.app.ActivityThread.main(ActivityThread.java:4627)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at java.lang.reflect.Method.invokeNative(Native Method)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at java.lang.reflect.Method.invoke(Method.java:521)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    04-10 19:40:19.573: E/AndroidRuntime(306):  at dalvik.system.NativeStart.main(Native Method)

What can I do to solve this problem?

(I've tried for hours - weeks to be honest, to solve my problem.)

Community
  • 1
  • 1
Stelufa
  • 41
  • 4
  • Is the jar containing that class on your classpath? – Guillaume Polet Apr 10 '12 at 20:24
  • If you're using SDK tools r17 or later, then the answer to this http://stackoverflow.com/questions/9820675/gson-noclassdeffounderror-after-adt-and-sdk-tools-update-to-v17 question probably holds the answer – NickT Apr 10 '12 at 20:27

1 Answers1

0

A couple of steps to solve this problem:

  1. Remove the JAR file from your project, and clean build the project
  2. If you are building using Ant, manually delete content of the gen and bin folders.
  3. Add a JAR file in your project. If you are using a library project which is using this JAR file then add the class path of the library too

This will solve your problem. Just to make sure which version of Android SDK you are using.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kodeshpa
  • 549
  • 5
  • 14