Reputation: 1037
I try to use annotation in my app. I created interface as it's said in docs but MappingJackson2HttpMessageConverter.class is not found. Could you tell me why ? EvenList is also not found :/
@Rest(converters = { MappingJackson2HttpMessageConverter.class })
public interface MyRestClient {
@Get("http://company.com/ajax/services/events")
EventList getEvents();
}
Annotation works fine. My build.gradle :
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.2'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.example.package.name'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.example.package.name"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
Upvotes: 1
Views: 701
Reputation: 1691
Android Annotation REST API is a wrapper around the Spring Android RestTemplate Module. Therefore you need to add android spring dependencies to your gradle files.
dependencies {
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
}repositories {
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
Also do not forget to include line below to your implementation class
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
Upvotes: 2