3

When trying to define a rest template using the @Rest annotation, and when providing one or more "converters" in that annotation, I receive the following compile error:

The converter class must be a subtype of org.springframework.http.converter.HttpMessageConverter

When, in fact, I have tried to pass in GsonHttpMessageConverter.class and MappingJacksonHttpMessageConverter.class which are both such subtypes.

I have the following libraries included in my /libs directory

androidannotations-api-2.7.1.jar
gson-2.2.4.jar
jackson-core-asl-1.9.12.jar
jackson-mapper-asl-1.9.12.jar
spring-android-auth-1.0.1.RELEASE.jar
spring-android-core-1.0.1.RELEASE.jar
spring-android-rest-template-1.0.1.RELEASE.jar

I'm not sure if this is an issue with AndroidAnnotations or with my own setup, but help would be appreciated.

Studio4Development
  • 725
  • 1
  • 6
  • 18

2 Answers2

1

I had the same problem but I solved it. Only change my Eclipse. I was using Helios with Android Development Toolkit

Now I dowload The Android SDK than includes Eclipse + ADT plugin. Use my old workspace with my proyect and all work fine!!!.

Sinffredy
  • 31
  • 8
0

Hello its too late for answer but could be helpfull for others also who are searching for the same use Below code snippets for your problem:-

@Rest(rootUrl =  BASE_URL, converters = {ByteArrayHttpMessageConverter.class,
    FormHttpMessageConverter.class, StringHttpMessageConverter.class})
  • it is working for image as well and string params as well
Hardy
  • 2,576
  • 1
  • 23
  • 45