在 android studio 3.0 中构建 gradle 时出现 dex 合并问题

Getting dex merge issue when build the gradle in android studio 3.0

我无法构建 gradle 并使用 android studio 3.0 稳定版 error.I 获取

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. com.android.builder.dexing.DexArchiveMergerException: Unable to merge 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.jar(;;;;;;**.class)] (Duplicate zip entry [13.jar:android/support/v4/view/ViewPager.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'
}

我尝试了很多次清理和重建但没有用

1.重建你的项目

2.清理你的项目然后重建它。

3.删除/project目录下的/build目录,删除/project/app/目录下的/build目录,然后重新制作项目。

4. 如果您已经安装了该应用程序,请将其卸载。

1. 如果不能从 android studio 菜单中重建您的项目 使缓存/限制无效...

2.清理你的项目然后重建它。

3.删除/project目录下的/build目录,删除/project/app/目录下的/build目录,然后重新制作项目。

5. 来自 android studio 菜单 Invalidate caches/ restrat... 4. 如果您已经安装了该应用程序,请将其卸载。

可以帮到你