Java 生成Android Studio 3时出错

Java 生成Android Studio 3时出错,java,android,mobile,Java,Android,Mobile,我想构建一个旧项目,我尝试了不同的解决方案,比如添加在另一个项目中有效的“multiDexEnabled true”。但我有一个错误: 提前感谢您的帮助和回答 Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerE

我想构建一个旧项目,我尝试了不同的解决方案,比如添加在另一个项目中有效的“multiDexEnabled true”。但我有一个错误:

提前感谢您的帮助和回答

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
以下是该项目的“build.gradle”:

ext {
    compileSdkVersion = 26
    buildToolsVersion = System.properties['buildToolsVersion']
    minSdkVersion = 21
    targetSdkVersion = 26
}

buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'http://repo.spring.io/milestone'
        }
        maven {
            url 'http://download.crashlytics.com/maven'
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
    }

    tasks.withType(JavaCompile) {
        options.encoding = "UTF-8"
    }
}
以及模块的“build.gradle”:应用程序:

apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

configurations {
    provided
    compile.exclude module: 'support-v7'
}

sourceSets {
    main {
        compileClasspath += configurations.provided
    }
}

repositories {
    mavenCentral()
    maven { url 'http://download.crashlytics.com/maven' }
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId '....'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 26
        versionName "2.0.6"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
    }
    productFlavors {
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':Mobiscan')
//    compile project(':calligraphy')
    compile project(':WheelSpinner')
    compile project(':overScrollListView')
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
    compile('org.simpleframework:simple-xml:2.7.+') {
        exclude module: 'stax'
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }
    compile project(':Parallax')
    compile 'com.crashlytics.android:crashlytics:1.+'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'me.biubiubiu.justifytext:library:1.1'
    compile 'com.google.android.gms:play-services:11.4.0'
    compile 'com.android.support:multidex:1.0.1'
}
“gralde wrapper.properties”:

然后是“setting.gradle”:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
include ':app', ':ResideMenu', ':Mobiscan', ':calligraphy', ':WheelSpinner', ':overScrollListView', ':Parallax'

if (!System.properties['buildToolsVersion']) {
    System.properties['buildToolsVersion'] =  "26.0.2"
}

if (!System.properties['androidGradlePluginVersion']) {
    System.properties['androidGradlePluginVersion'] = "3.0.1"
}