错误:任务':app:transformClassesWithDexForDebug'执行失败。不解决

时间:2016-03-16 08:29:00

标签: android android-studio library-project

我可能已尝试过有关此问题的所有解决方案。 完整错误是:错误:任务"

的执行失败
&ScrArray[][]

" 我发布了我的build.gradle脚本: 脚本名称:RajawaliCardBoardExample-master

':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

name:Module:app>>

// Top-level build file where you can add configuration options common to all sub-projects/modules.



buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

name:Module:lib_panorama_max>>

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
        jumboMode = true
    }

    defaultConfig {
        applicationId "com.eje_c.rajawalicardboard"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':rajawalicardboard')
    compile project(':lib_panorama_max')
    compile 'com.android.support:multidex:1.0.1'
}

名称:模块:Rajawali>>

apply plugin: 'java'

task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
    destinationDir file("$buildDir/native-libs")
    baseName 'native-libs'
    extension 'jar'
    from fileTree(dir: 'libs', include: '**/*.so')
    into 'lib/'
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(nativeLibsToJar)
        options.encoding = "UTF-8"
        options.debug = true
        options.debugOptions.debugLevel = "source,lines,vars"
        options.encoding = "UTF-8"
}


dependencies {
    compile files('libs/commons-httpclient-3.1.jar')
    compile files('libs/android.jar')
    compile fileTree(dir: 'build/native-libs', include: ['*.jar'])
}

名称:模块:rajawalicardboard>>

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    dexOptions {
        incremental true
        javaMaxHeapSize "2048M"
        jumboMode = true
    }
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

请帮忙解决一下! :(

2 个答案:

答案 0 :(得分:1)

首先你应该添加

 defaultConfig
 {

    // Enabling multidex support.
       multiDexEnabled true
 }

打开Module:app。您在此处缺少multiDexEnabled true

defaultConfig {
    applicationId "com.eje_c.rajawalicardboard"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}

阅读有关 MultiDex

的正式文件

答案 1 :(得分:0)

选项1正在添加multiDexEnabled true 但你告诉它根本不起作用,你现在可以尝试排除group group: 'com.android.support', module: 'multidex',这意味着在汇编中更改

compile project(':rajawalicardboard')

compile project(':rajawalicardboard'){
        exclude group: 'com.android.support', module: 'multidex'
    }

不要只尝试这个,如果只有上述更改不起作用,请在compile project(':lib_panorama_max')中执行相同操作。尝试删除compile 'com.android.support:multidex:1.0.1'