我正在Android项目中用Kotlin测试Dagger 2.我受到了Android Clean Architecture回购的启发.我的gradle构建中有两个模块,一个是"app",另一个是"module".模块包含一个类调用模型.在我的app gradle模块中,我使用Model提供程序创建了一个名为"DaggerModule"的匕首模块.当我尝试构建项目时,出现编译错误:
DaggerModule.kt: (3, 57): Unresolved reference: Model
DaggerModule.kt: (9, 34): Unresolved reference: Model
DaggerModule.kt: (9, 42): Unresolved reference: Model
Run Code Online (Sandbox Code Playgroud)
当我尝试将Model类从"module"模块移动到"app"模块内部时,所有内容都编译为w/o错误.试图弄清楚我是在做一些愚蠢的事情,还是我应该在某个地方提交一个bug.
这里参考有问题的文件的片段:
----
app/build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.1218'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
repositories {
jcenter()
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.github.app.kotlin_unresolved_reference.app"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6 …Run Code Online (Sandbox Code Playgroud)