我遇到以下错误
错误:任务执行失败
应用:transformDexArchiveWithExternalLibsDexMergerForDebug java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
当房间和设计库在同一个应用程序中使用时。任何人都可以帮忙解决这个问题。
注意:我启用了multidex,并尝试使用更高的堆大小。
https://github.com/googlecodelabs/android-persistence
实施(“com.android.support:design:27.1.1”)依赖。
Android Studio V 3.0 操作系统 - Windows 10 Pro
你能帮忙解决这个问题吗?
这是build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
applicationId 'com.example.android.codelabs.persistence'
minSdkVersion 21
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
productFlavors {
}
// To avoid lint errors on generated sources, we temporarily disable abortOnError
// until the fix is released.
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:' + rootProject.espressoVersion, {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:' + rootProject.supportLibVersion
implementation 'com.android.support:cardview-v7:' + rootProject.supportLibVersion
implementation 'com.android.support:recyclerview-v7:' + rootProject.supportLibVersion
implementation 'com.android.support:support-v4:' + rootProject.supportLibVersion
implementation("com.android.support:design:27.1.1")
testCompile 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.3'
implementation('android.arch.lifecycle:extensions:' + rootProject.archLifecycleVersion){
exclude group: 'com.android.support', module: 'support-fragment'
}
implementation ('android.arch.persistence.room:runtime:' + rootProject.archRoomVersion){
exclude group: 'com.android.support', module: 'support-annotations'
}
annotationProcessor 'android.arch.lifecycle:compiler:' + rootProject.archLifecycleVersion
annotationProcessor 'android.arch.persistence.room:compiler:' + rootProject.archRoomVersion
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}