首页 > 其他分享 >Annotation processors must be explicitly declared now

Annotation processors must be explicitly declared now

时间:2023-09-08 11:44:42浏览次数:27  
标签:... declared processors module explicitly now Annotation

Android Studio升级到最新版3.0 Canary 8后,当使用到注解时,报了如下错误:

Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
    - butterknife-8.8.1.jar
  Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
  See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

借鉴网友的解决方法,在引用注解库的module下的build.gradle文件中,添加了如下配置。

android {
    ...
    
    defaultConfig {
        ...

        javaCompileOptions { 
            annotationProcessorOptions { 
                includeCompileClasspath = true 
            } 
        }
    }
    
    ...
}

遗憾的是,添加上述配置之后,仍然出现这个错误;

这个时候转念一想,工程结构是多module形式的,会不会是重复依赖导致的呢?顺着这个想法,到每个module下的build.gradle文件搜索,发现的确在两个module下都依赖了butterknife注解库。

找到问题就很好解决了,只要去除掉其中一个依赖就可以了。

   

标签:...,declared,processors,module,explicitly,now,Annotation
From: https://www.cnblogs.com/wanglongjiang/p/17687188.html

相关文章

  • 编译Sophus报错: error: implicitly-declared 的参考解决方法
    一、问题描述自己在编译Sophus时遇到如下错误:/home/wong/Datum/third_party/Sophus-1.0.0-template/Sophus-1.0.0/test/core/test_so2.cpp:82:31:error:implicitly-declared‘Eigen::Map<constSophus::SO2<double>>::Map(constEigen::Map<constSophus::SO2<double&g......
  • Ubuntu 20.04编译opencv-3.1.0时报错 error: 'CODEC_FLAG_GLOBAL_HEADER' was not dec
    Ubuntu20.04源码编译安装opencv320报错error:'CODEC_FLAG_GLOBAL_HEADER'wasnotdeclaredinthisscope的解决办法:修改/opt/opencv/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp,顶端添加如下代码:#defineAV_CODEC_FLAG_GLOBAL_HEADER(1<<22)#defineCODEC_F......
  • 跨版本迁移数据报错tables declared WITH OIDS are not supported
    瀚高数据库目录环境症状问题原因解决方案环境系统平台:Linuxx86-64RedHatEnterpriseLinux7版本:6.0症状迁移数据还原数据库时报错ERROR:tablesdeclaredWITHOIDSarenotsupported问题原因Postgresql12后取消了OIDS=TRUE的用法。解决方案修改脚本中的语句脚本中出现OIDS=T......
  • 解决小程序报错 getLocation:fail the api need to be declared in the requiredPriva
    一、unipp项目打开uniapp项目的配置文件manifest.json,选择“源码视图”。/*小程序特有相关*/"mp-weixin":{"appid":"你的开发者id","setting":{"urlCheck":true,"es6":true,"postcss":......
  • uniapp获取位置时显示getLocation:fail the api need to be declared in the required
    uniapp获取位置时显示getLocation:failtheapineedtobedeclaredintherequiredPrivateInfosfieldinapp.json/ext.json解决方式:1.manifest.json文件 "mp-weixin" 中添加"permission":{"scope.userLocation":{&quo......
  • error: ‘strdup’ was not declared in this scope; did you mean ‘StrDup’ fileno
     {https://news.68idc.cn/buildlang/20150627387345.html}{函数名:strdup;功能:将串拷贝到新建的位置处;用法:char*strdup(char*str);strdup属于GNUC++的函数,不是标准(std)C++的函数,需要修改参数:把-std=c++11修改为-std=gnu++0x,即可.}函数名:strdup;功......
  • Uncaught SyntaxError: Identifier 'originalPrompt' has already been declared
    控制台报错:UncaughtSyntaxError:Identifier'originalPrompt'hasalreadybeendeclared网上查询相关资料,预测是GoogleChrome浏览器安装了插件跟Vue项目运行代码出现了冲突。解决方法:关闭相关插件即可,【可能导致问题产生的插件有:SeleniumIDE】。参考文档:http://www.dtm......
  • 'function': was declared deprecated
    1.警告消息'function':wasdeclareddeprecatedCompilerWarning(level1)C4996ErrorMessage'function':wasdeclareddeprecatedThecompilerencounteredafunctionthatwasmarkedwithdeprecated.Thefunctionmaynolonger......
  • Python编码错误:no encoding declared
    问题描述Python文件中如果未指定编码,在执行过程会出现报错:....,butnoencodingdeclared....问题原因Python中默认的编码格式是ASCII格式,在没修改编码格式时无法正确打印汉字,所以在读取中文时会报错。Python3.X源码文件默认使用utf-8编码,所以可以正常解析中文,无需指定......
  • 关于TypeScript中提示xxx is declared but its value is never read的解决方法
    首先,提示很明显,是定义了变量,但是却没有使用。解决方案有如下两种: 一:需要确定变量是否真的没有使用到,如果没有使用直接删除即可。 二:对于方法中的入参,是没法随便删除的。这时候我们可以利用TypeScript4.2中的新特性,将变量名用下划线开头,表示占位变量。更具体的详情可......