Search code examples
javaandroidrestandroid-annotations

MappingJackson2HttpMessageConverter import failed


I'm trying to make REST api client class using android annotation , i am in my learning phase of this library , I am using same class given in android annotation wiki page of REST client, i have following problem regarding this code.

Problems:

  1. How to import MappingJackson2HttpMessageConverter , i am unable to import this class?

Attempt: my build.gradle looks like this:

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = "4.0.0"
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.1.1'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    apt "org.androidannotations:rest-spring:$AAVersion"
    compile "org.androidannotations:rest-spring-api:$AAVersion"

    compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'

}
  1. Are there any good tutorials except its original wiki to learn and use android annotation REST ?

Thanks in advance


Solution

  • You have to add this

    repositories {
      maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    
    dependencies {
      compile "org.springframework.android:spring-android-rest-template:2.0.0.M3"
    }
    

    As the AA wiki says, you have to make sure you have the Spring REST dependency in your project.