博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 2.3已封锁使用Android-Apt,需使用annotationProcessor
阅读量:6965 次
发布时间:2019-06-27

本文共 1893 字,大约阅读时间需要 6 分钟。

From apt to annotationProcessor As of the Android Gradle plugin version 2.2, all functionality that was previously provided by android-apt is now available in the Android plugin. Android Gradle 2.3 is actively blocking android-apt now in anticipation of upcoming changes to the Android Gradle plugin. This means that android-apt is officially obsolete ;)

Here are the steps to migrate:

Make sure you are on the Android Gradle 2.2 plugin or newer. Remove the android-apt plugin from your build scripts Change all apt, androidTestApt and testApt dependencies to their new format: dependencies { compile 'com.google.dagger:dagger:2.0' annotationProcessor 'com.google.dagger:dagger-compiler:2.0' } annotationProcessor replaces apt in this example.

Processor arguments The Android Gradle plugin also allows configuring of processor arguments, just like the apt {} configuration block in android-apt. Unlike the android-apt configuration block, the variant or project are not passed into this block.

Here's an example configuration:

android { ... defaultConfig { ... javaCompileOptions { annotationProcessorOptions { className 'com.example.MyProcessor'

// Arguments are optional.            arguments = [ foo : 'bar' ]        }    }}...复制代码

} More info The Android plugin annotation processor works with both javac and jack, unlike android-apt which only works with javac. For more info you can refer to the docs (scroll down a bit on that page).

Known issues If you encounter an issue after migrating it might be a bug in the Android Gradle plugin. Please report these bugs in in the Android bug tracker. You can still revert to android-apt if you are not using Jack in the mean time.

Current issues that I'm aware of:

Test configurations not added to model: https://code.google.com/p/android/issues/detail?id=224272 There's no support annotation support in project using the Android Groovy plugin.

转载地址:http://ysbsl.baihongyu.com/

你可能感兴趣的文章
YII 联合查询
查看>>
PHP扩展模块Memcache Redis Mssql部署
查看>>
盘点11个面向文档的开源NoSQL数据库
查看>>
eclipse 快捷键
查看>>
最长有效括按号长度(利用栈解决java语言)
查看>>
用Gvim建立IDE编程环境 (Windows篇)
查看>>
ansible及ansible-palybook使用(持续更新)
查看>>
关于endian的故事,big-endian和little-endian
查看>>
Spring定时任务的几种实现
查看>>
使用JMeter进行性能测试
查看>>
使用@Controller注解为什么要配置<mvc:annotation-driven />
查看>>
彪悍的人生不需要解释
查看>>
近期学习的LINUX 命令
查看>>
域策略 设置本地管理员
查看>>
ie6 css :hover 和 select遮挡问题、和z-index失效问题
查看>>
9月22号
查看>>
Attempted to access a cursor after it has been clo
查看>>
Oneproxy 读写分离
查看>>
我的友情链接
查看>>
textarea 在浏览器中固定大小和禁止拖动
查看>>