【发布时间】:2017-11-06 09:07:45
【问题描述】:
我无法构建 gradle 并出现错误。我使用的是 android studio 3.0 稳定版
错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。 com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex
详情:
Information:Gradle tasks [clean, :app:assembleDebug]
Error:Execution failed for task
':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [D:\Studio Projects\SampleMVP
\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [D:\Studio Projects\SampleMVP\app\build\intermediates\transforms\desugar\debug\13.jar(;;;;;;**.class)] (Duplicate zip entry [13.jar:android/support/v4/view/ViewPager$1.class]))
Information:BUILD FAILED in 4m 6s
Information:1 error
Information:0 warnings
Information:See complete output in console
我的app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
applicationId "ocs.com.samplemvp"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
我尝试了很多次清理和重建但没有工作
【问题讨论】:
-
见here
标签: android android-gradle-plugin build.gradle gradle-plugin android-studio-3.0