应用模块中引用的Android库模块的“未解决的引用"错误 [英] 'Unresolved reference' errors for android library module referenced in app module
问题描述
我在项目中引用我的android库模块时遇到问题.除了主应用程序模块之外,我还使用了一个android库模块,该模块包含util或作为数据模块.我在应用模块中这样引用它:
I have problems referencing my android library modules in my projects. Beside the main app module I use to have an android library module with either util stuff or as data module. I reference it in app module like that:
dependencies {
implementation project(":data")
}
在我构建项目时,它会给我很多错误消息'Unresolved reference: ...'
,这些错误消息是我在app模块中引用到android库模块的所有内容的错误信息.但是IDE本身没有问题,Intelligent可找到所有类,接口等,导入很好,没有什么是红色的. android库模块本身会在输出中生成并创建aar-file
. compileDebugKotlin
任务失败
When I build the project, it´s giving me lot of error messages 'Unresolved reference: ...'
for all stuff that I reference in the app module to the android library module. But the IDE itself doesn´t have a problem, Intelligent finds all classes, interfaces etc., imports are fine, nothing is red. The android library module itself builds and creates aar-file
in the output. It´s the compileDebugKotlin
task that fails
任何一般的想法可能与这有什么关系?
Any general idea what may be related to that?
推荐答案
发现了问题,我的android库模块缺少kotlin配置:
Found the problem, my android library module was missing the kotlin configuration:
apply plugin: 'kotlin-android'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion:<version>"
}
尽管我在其中使用了kotlin .kt文件,但它可以在不存在的情况下也可以构建
Although I used kotlin .kt files in it, it could build without and also
Tools -> Kotlin -> 'Configure Kotlin in projects'
告诉我所有配置Kotlin文件的模块"
这篇关于应用模块中引用的Android库模块的“未解决的引用"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!