1
03-13 08:10:19.621: E/AndroidRuntime(800): java.lang.NoClassDefFoundError: 
com.sun.jersey.api.client.Client

Why im getting this exception?Though i have added jars.

madlymad
  • 6,367
  • 6
  • 37
  • 68
Amruta
  • 469
  • 2
  • 6
  • 16

3 Answers3

1

Add the used libraries in your application manifest:

<uses-library android:name="your library" />

Edit:

btw. make sure that you have added jersey-core to your classpath too, as it is a dependency for com.sun.jersey.api.client.Client.

Blizzer
  • 260
  • 4
  • 22
0

You should try this:

  1. Remove all references to the JAR in your project from Java project -> properties -> Java build path -> libraries

  2. Create a libs folder if not exist at the root of your project Copy the JAR into the libs folder.

  3. If still not running . Right click your project > Android Tools > Fix Project Properties

clean your project and run. it will work

RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
  • what's your problem now.is it same or any other – RajaReddy PolamReddy Mar 13 '13 at 09:40
  • When I'm following above steps. I'm getting below error [2013-03-13 14:08:57 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/sun/jersey/core/util/MultivaluedMapImpl; [2013-03-13 14:08:57 - DictionaryApplication] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/sun/jersey/core/util/MultivaluedMapImpl; – Amruta Mar 13 '13 at 09:46
  • actually if your facing problem with jar files this solution will solve your problem, but your error is not relating to that. show me which line causes error in your code. – RajaReddy PolamReddy Mar 13 '13 at 10:08
  • I got to know that jersey is a heavy weight for android so i shifted to HttpClient to make a web service but now i get INSTALL_FAILED_MISSING_SHARED_LIBRARY error. – Amruta Mar 13 '13 at 10:25
  • are you using any google maps in your applivcation, if yes are you using google map support emulator to run the application.. – RajaReddy PolamReddy Mar 13 '13 at 10:27
  • Nope.I resolved that issue.Im trying to hit WordNik webservice and now im getting android.os.NetworkOnMainThreadException. – Amruta Mar 13 '13 at 10:33
  • android.os.NetworkOnMainThreadException. you have to run code related to web in AsyncTask...http://stackoverflow.com/a/6343299/964741 – RajaReddy PolamReddy Mar 13 '13 at 10:38
0

Looks like you have added jar files into project but haven't added them as Library, just follow these steps,

  • Right Click on your project, select "Build Path"
  • From Build Path select "Configure Build Path"
  • Select "Library" Tab from the dialog
  • Click on first button "Add Jars"
  • Select jar files from your Project folder
  • Clean the project and done.
Raynold
  • 443
  • 2
  • 9
  • 28
  • When I'm following above steps. I'm getting below error [2013-03-13 14:08:57 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/sun/jersey/core/util/MultivaluedMapImpl; [2013-03-13 14:08:57 - DictionaryApplication] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/sun/jersey/core/util/MultivaluedMapImpl; – Amruta Mar 13 '13 at 08:42
  • in which folder of your project you have put your .jar files ? – Raynold Mar 13 '13 at 08:45