您的位置:首页 > 移动开发 > Android开发

Android Annotations 4.0.0 配置Rest API

2016-06-25 20:06 801 查看
AndroidAnnotations 从4.0.0开始模块化了,rest-api作为单独的模块发行。在下面的介绍中有增加一个android annotations模块的方法。

https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle#adding-more-aa-plugins

下面我只说下我的配置:

在项目的build.gradle文件中添加依赖

apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
apt "org.androidannotations:rest-spring:$AAVersion"
compile "org.androidannotations:rest-spring-api:$AAVersion"
provided 'org.springframework.android:spring-android-rest-template:2.0.0.M3'


需要依赖Spring For Android。依赖的时候如果用compile,会提示重复引用了Jar包,不加的话,需要的类Android Studio都不提示。所以改成provided了。

需要注意的是,需要在项目的build.gradle和app的build.gralde里同时添加

maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}


开始只在项目的build.gralde里添加的,一直编译不了。后来在app的build.gradle也加上就编译通过了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: