错误:Gradle:任务执行失败':app:transformDexArchiveWithDexMergerForDebug'

时间:2018-01-30 09:47:50

标签: android mvvm kotlin

我使用带有MVVM架构的Kotlin构建应用程序,现在我为我的ViewModel编写单元测试,只需使用trJUnit

Mockito

但是,当我尝试运行测试时,我得到以下错误:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.github.bumptech.glide:glide:4.1.0'
    kapt 'com.github.bumptech.glide:compiler:4.1.0'
    kapt 'com.android.databinding:compiler:3.0.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    testImplementation 'org.mockito:mockito-core:2.12.0'
}

这是我的测试类:

Error:Gradle: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Landroid/support/compat/R$bool;

我仍然不知道为什么。有任何想法吗? 谢谢?

0 个答案:

没有答案