Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug'

Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug'

我的 Android Studio 是 2.3 版本。我正在尝试 运行 代码,但应用程序失败并出现以下错误,不确定是什么问题。

这里是错误:

Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug' com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --output C:\project\app\build\intermediates\reload-dex\debug C:\project\app\build\intermediates\reload-dex\debug\classes.jar}

build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.ucmedia.project"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        apply plugin: 'com.android.application'
        multiDexEnabled true
        }
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }}
dexOptions {
    preDexLibraries false
    javaMaxHeapSize "4g"
    jumboMode true
}}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
    {exclude group: 'com.android.support', module: 'support-annotations'})
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.android.support:design:25.2.0'
    testCompile 'junit:junit:4.12'
}

我尝试了以下方法,但错误仍然存​​在:

尝试改变 编译 'com.google.android.gms:play-services:8.1.0'

将以下代码添加到 'build.gradle' 应用模块解决了我的问题:

dependencies {
    ...
    compile 'com.android.support:multidex:1.0.0'
    ...
}