Gradle no puede resolver references de otro module

Tengo un proyecto con los siguientes modules:

  • Aplicación
  • Dispositivo

La aplicación depende del dispositivo. El dispositivo contiene una class NetworkComponent a la que hace reference la aplicación. Más específicamente:

package com.some.package.ui.login; import android.content.Intent import android.os.Bundle import android.support.v7.app.AppCompatActivity import com.some.package.R import com.some.package.device.network.NetworkComponent import com.some.package.ui.terms.TermsActivity class LoginActivity : AppCompatActivity(), LoginViewModel.Navigator { val loginViewModel by lazy { LoginViewModel(this, NetworkComponent()) } 

Todo se resuelve bien en Android Studio. Sin embargo, cuando bash build el proyecto, encuentro un error de compilation:

 e: /Users/android/some-app-android/app/src/main/kotlin/com/some/package/ui/login/LoginActivity.kt: (7, 27): Unresolved reference: network e: /Users/android/some-app-android/app/src/main/kotlin/com/some/package/ui/login/LoginActivity.kt: (13, 55): Unresolved reference: NetworkComponent [KOTLIN] deleting /Users/android/some-app-android/app/build/tmp/kotlin-classes/debug on error [KOTLIN] deleting /Users/android/some-app-android/app/build/tmp/kotlin-classes/debug on error :app:compileDebugKotlin FAILED 

Esto es a lo que se parece NetworkComponent:

 package com.some.package.device.network import com.some.package.domain.datasources.CodeValidator import retrofit2.Retrofit class NetworkComponent : CodeValidator { val codeValidator: CodeValidatorApi init { val retrofit = Retrofit.Builder() .baseUrl("www.test.com") .build() codeValidator = retrofit.create(CodeValidatorApi::class.java) } override fun validate(code: String) = codeValidator.validate(code) } 

Aquí están los files de compilation:

Parte superior:

 buildscript { ext.kotlin_version = '1.1.51' ext.android_tools = '3.0.0' repositories { google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:$android_tools" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() jcenter() mavenCentral() } } 

Aplicación:

 buildscript { repositories { mavenCentral() } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' //apply plugin: 'io.fabric' // Manifest version information def versionMajor = 0 def versionMinor = 0 def versionPatch = 1 android { compileSdkVersion 27 defaultConfig { applicationId "com.some.package" minSdkVersion 21 targetSdkVersion 27 versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch versionName "${versionMajor}.${versionMinor}.${versionPatch}" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { debug { // applicationIdSuffix '.debug' resValue "string", "application_name", "TEST APP Debug" debuggable true } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' resValue "string", "application_name", "TEST APP" } } dataBinding { enabled = true } sourceSets { main.java.srcDirs += 'src/main/kotlin' debug.java.srcDirs += 'src/debug/kotlin' } packagingOptions { exclude 'META-INF/ASL2.0' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/services/javax.annotation.processing.Processor' // butterknife } } repositories { maven { url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo' } } dependencies { implementation project(':device') implementation project(':data') implementation project(':domain') implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:support-v4:27.0.0' implementation 'com.android.support:appcompat-v7:27.0.0' implementation 'com.android.support:design:27.0.0' implementation 'com.android.support:support-annotations:27.0.0' kapt "com.android.databinding:compiler:$android_tools" // Logging implementation 'com.jakewharton.timber:timber:4.5.1' // Unit tests testImplementation 'junit:junit:4.12' // testImplementation 'org.robolectric:robolectric:3.0' testImplementation 'org.mockito:mockito-core:2.11.0' // testImplementation 'joda-time:joda-time:2.9.4' // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1' // releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' // testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0' debugImplementation 'com.facebook.stetho:stetho:1.4.1' debugImplementation 'com.uphyca:stetho_realm:2.0.0' // implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { // transitive = true; // } } 

Dispositivo:

 apply plugin: 'com.android.library' android { compileSdkVersion 27 defaultConfig { minSdkVersion 21 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main.java.srcDirs += 'src/main/kotlin' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':domain') androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation 'com.android.support:appcompat-v7:27.0.0' implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0' implementation "com.squareup.retrofit2:retrofit:2.3.0" implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0" testImplementation 'junit:junit:4.12' } 

No estoy muy seguro de cómo puede pasar esto. Intenté degradar el plugin de Gradle a 2.3.3, pero no tuve suerte.

¿Algunas ideas?