报错信息:
ARouter::Compiler An exception is encountered, [These no module name, at 'build.gradle', like :
android {
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
}
]
Execution failed for task ':settings:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
刚开始报错配置如下:
Base Module:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
}
dependencies {
api 'com.alibaba:arouter-api:1.5.2'
kapt 'com.alibaba:arouter-compiler:1.5.2'
}
Other Modules:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
}
dependencies {
api project(':base')
kapt 'com.alibaba:arouter-compiler:1.5.2'
}
总是提示我没有配置【javaCompileOptions】这部分,但是我明明配置了,换成kotlin版的也不行:
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
后来想到项目中有java代码,也有kotlin代码,于是两个版本都一起配置上去了,居然就行了,这坑真是深,接入的版本是1.5.2
android {
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
}
|