kotlin-android插件导致产生依赖关系问题

时间:2018-12-05 20:58:14

标签: kotlin android-gradle gradle-dependencies

我刚刚开始将我的一些junit测试用例从Java重构为Kotlin,当我尝试生成依赖项锁时,我看到了问题:

在我的学习中,我所做的修改是

apply plugin: 'kotlin-android'
.
.
android {
    sourceSets {
        test.java.srcDirs += 'src/test/kotlin'
    }
}
.
.
testImplementation libraries.kotlin_stdlib_jre8

我用来生成依赖项锁定的命令-

./gradlew -PdependencyLock.ignore=false :apps:MyProj:generateLock

我看到的错误是

> Could not resolve all dependencies for configuration ':apps:MyProj:debugImplementationDependenciesMetadata'
    > Cannot choose between the following variants of project :app:MySubmodule
      - kapt
      - kaptAndroidTest
      - kaptAndroidTestDebug
      - kaptDebug
      - kaptRelease
      - kaptTest
      - kaptTestDebug
      - kaptTestRelease
All of them match the consumer attributes:
      - Variant 'kapt':
          - Found artifactType 'processed-jar' but wasn't required.
          - Required org.jetbrains.kotlin.platform.type 'common' but no 
value provided.
      - Variant 'kaptAndroidTest':
          - Found artifactType 'processed-jar' but wasn't required.
          - Required org.jetbrains.kotlin.platform.type 'common' but no 
value provided.
      - Variant 'kaptAndroidTestDebug':
.
.
.

当前,我仅尝试将Java测试转换为kotlin,而不是代码。

0 个答案:

没有答案