任务执行失败':app:transformClassesWithMultidexlistForDebug'在Android Studio 2.3中

时间:2017-11-28 07:56:55

标签: android android-studio android-gradle

我可以构建我的项目但无法运行应用程序。执行应用程序时,它给出了像

这样的错误

任务执行失败':app:transformClassesWithMultidexlistForDebug'。

  

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:使用带有参数的主类com.android.multidex.ClassReferenceListBuilder执行java进程时出错{/ home / Git_Projects / Test1 / app / build / intermediates / multi-dex / debug / componentClasses.jar /home/Git_Projects/Test1/app/build/intermediates/transforms/jarMerging/debug/jars/1/1f/combined.jar}

我尝试clean and rebuild projectInvalidate Catche and Restart。但是,没有任何帮助我。

build.gradle(app)

apply plugin: 'com.android.application'

android {
    dexOptions {
        javaMaxHeapSize "4g"
    }
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.app.test1"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    maven { url 'https://github.com/Kaustubh-Deshmukh/progressbar_repo/raw/master' }

    maven { url 'https://dl.bintray.com/yazeed44/maven' }
    }

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-places:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.android.gms:play-services-vision:10.0.1'

    compile 'com.github.clans:fab:1.6.4'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.1.1'
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:design:26.0.0'
    compile 'com.android.support:recyclerview-v7:26.0.0'
    compile 'com.android.support:cardview-v7:26.0.0'
    compile 'com.android.support:support-v4:26.0.0'
    compile 'com.android.support:support-annotations:26.0.0'
    compile 'com.android.support:percent:26.0.0'
    compile 'com.android.support:support-v13:26.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.facebook.fresco:fresco:1.5.0'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.kontaktio:sdk:3.3.2'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

    testCompile 'junit:junit:4.12'
}

如果我随机删除一些依赖项,那么它执行正常。大型应用程序大小是否会产生执行应用程序的问题?

我正在使用 android studio 2.3 java-8-openjdk-amd64 ubuntu 16.04

一件奇怪的事:在执行命令

之前,一切正常
apt-get update

我正在寻找几天,但似乎没什么用。

3 个答案:

答案 0 :(得分:0)

从build.gradle文件开始,您有两个版本的
compile 'com.android.support:support

请尝试仅使用以下其中一项:

compile 'com.android.support:support-v4:26.0.0'
   compile 'com.android.support:support-v13:26.0.0'

答案 1 :(得分:0)

尝试将以下内容添加到build.gradle

compileOptions {  
        sourceCompatibility JavaVersion.VERSION_1_7  
        targetCompatibility JavaVersion.VERSION_1_7  
}

尝试按命令行构建

gradle clean assembleDebug

答案 2 :(得分:0)

将Android Studio 2.3.0 更新为 3.0.1 后,我的问题解决了。

现在,它完美无缺。