AndroidStudio版本:3.5.2

gradle版本:5.4.1
tools:com.android.tools.build:gradle:3.5.3
 

网上搜了下,都说是需要将要编译注解的library添加
annotationProcessor即可。
可是我看了我的项目结构,已经添加了这些依赖:

app.build
android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig {
applicationId "com.magic.ppjoke" minSdkVersion 22 targetSdkVersion 29
versionCode 1 versionName "1.0" testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner" } buildTypes { release {
minifyEnabled false proguardFiles
getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' }
} compileOptions { sourceCompatibility "1.8" targetCompatibility "1.8" } }
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation
'com.google.android.material:material:1.0.0' implementation
'androidx.constraintlayout:constraintlayout:1.1.3' implementation
'androidx.navigation:navigation-fragment:2.0.0' implementation
'androidx.navigation:navigation-ui:2.0.0' implementation
'androidx.lifecycle:lifecycle-extensions:2.0.0' testImplementation
'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':libnavannotation') annotationProcessor
project(":libnavcompiler") }  
libnavcompiler.build
apply plugin: 'java-library' dependencies { implementation fileTree(dir:
'libs', include: ['*.jar']) implementation project(':libnavannotation')
implementation 'com.alibaba:fastjson:1.2.59' api
'com.google.auto.service:auto-service:1.0-rc6' annotationProcessor
'com.google.auto.service:auto-service:1.0-rc6' } sourceCompatibility = "8"
targetCompatibility = "8"
然而....依然没有打印我使用Messger打印的日志
messager = processingEnvironment.getMessager();
messager.printMessage(Diagnostic.Kind.NOTE, "[resourcePath]" + resourcePath);
最后发现是因为我的jdk版本使用的是AndroidStudio默认的,所以才没有执行。

打开ProjectStructure后,设置为JDK1.8即可。

 

设置完后,文件成功生成,日志也在Build窗口打印。

技术
今日推荐
PPT
阅读数 131
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信