I want to use Jersey Client in my Android application. This is the code for my client:
private JSONArray getJsonElements(){
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(getBaseURI());
JSONArray jarray = new JSONArray();
jarray = service.path("/collection").accept(MediaType.APPLICATION_JSON).get(JSONArray.class);
Log.v(TAG, jarray.toString());
return jarray;
}
private static URI getBaseURI() {
return UriBuilder.fromUri("http://localhost:6577/Example/rest/Example")
.build();
}
And here comes the problem.When i want to build application it gives me this very common exception:
java.lang.IllegalArgumentException: already added: Ljavax/ws/rs/core/GenericEntity;...2012-07-07 16:48:32 - SM] Conversion to Dalvik format failed with error 1
I saw all questions that were asked about this exception.It is possible to remove Jars from BuildPath and change choice of client(or I can create my client),but I don't want to do this. What can you recommend to me?