应用模块中引用的 android 库模块的“未解决的引用"错误 [英] 'Unresolved reference' errors for android library module referenced in app module

查看:28
本文介绍了应用模块中引用的 android 库模块的“未解决的引用"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中引用我的 android 库模块时遇到问题.除了主应用程序模块,我还使用了一个带有 util 东西或作为数据模块的 android 库模块.我在应用模块中像这样引用它:

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: ...' 对于我在应用程序模块中引用到 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

<代码>工具 ->科特林 ->'在项目中配置 Kotlin'

告诉我'所有带有 Kotlin 文件的模块都已配置'

这篇关于应用模块中引用的 android 库模块的“未解决的引用"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆