问题:
今天运行代码,make编译突然报错了
错误提示内容
INFO: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompiler(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app
分析:
刚开始还以为是应用调用的方法getJavaCompiler异常导致的,查了下发现项目上并没有调用getJavaCompiler或getJavaCompileProvider,之后再网上查到:相关文章
参考这这篇文章和GreenDao的官方团队回答判断,应该是GreenDao框架引起的问题。
https://blog.youkuaiyun.com/shijianduan1/article/details/86509825
https://github.com/greenrobot/greenDAO/issues/942
解决:
导入GreenDao之后在build.gradle中配置如下:
需要将 targetGenDir 配置注释掉,修改后的代码如下
greendao {
schemaVersion 1//数据库版本号
daoPackage 'com.hww.facelog.face.db.greendao'//设置DaoMaster、DaoSession、Dao包名
// targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
}
修改后原本是在 src/main/java/com.hww.facelog.face.db.greendao 目录下自动生产代码,自动修改在app/build/generated/source/greendao/com.hww.facelog.face.db.greendao ,如下图
之后重新make一下就可以了