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文件中添加依赖
需要依赖Spring For Android。依赖的时候如果用compile,会提示重复引用了Jar包,不加的话,需要的类Android Studio都不提示。所以改成provided了。
需要注意的是,需要在项目的build.gradle和app的build.gralde里同时添加
开始只在项目的build.gralde里添加的,一直编译不了。后来在app的build.gradle也加上就编译通过了。
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也加上就编译通过了。
相关文章推荐
- 移动混合开发之android文件管理新建文件和删除文件
- Android Handler 详解
- android基础Handler小例子
- android-自定义View
- Ubuntu 下 使用 adb logcat 显示 Android 日志
- Android Gson解析Json(常规使用)
- Android数据存储(二)----- SharedPreferences存储
- android 自定义控件(五) 音量切换
- 创建ANDROID开发环境
- Android Studio 关联源码问题
- Android EditView 输入限制(软键盘限制)
- adb操作命令详解及大全
- Weex Android SDK源码分析之界面渲染(下)
- Android挂断电话代码
- 打造高质量Android应用读书笔记
- Android自定义ProgressBar
- android桌面快捷方式添加数字角标的踩坑之路
- Android捕捉图像后在SurfaceView上变形显示问题的处理
- android中handler和looper的工作原理
- php做接口+android 请求API接口并展示到ListView例子