错误:任务':app:transformClassesWithDexForDebug'执行失败。 > com.android.ide.common.process.ProcessException:

时间:2016-02-19 10:08:21

标签: android android-studio maven-2 android-gradle

这是我现在的ERROR,我也在stackoverflow中搜索了一些线程,但没有用,并且正在寻找解决方案。

  

错误:任务':app:transformClassesWithDexForDebug'执行失败。 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令' C:\ Program Files \ Java \ jdk1.7.0_80 \ bin \ java.exe& #39;'完成非零退出值1

build.gradle (Module:APP)

 apply plugin: 'com.android.application'
buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
   }
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.whyz.kitetech.mobile.cdrapp"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {

    debug {
        debuggable = true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
 }
 }

dependencies {
compile fileTree(dir: 'libs')
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true;
}
compile('com.digits.sdk.android:digits:1.9.4@aar') {
    transitive = true;
}
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
}

的build.gradle (项目:APP)

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.google.gms:google-services:2.0.0-alpha6'

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

allprojects {
repositories {
    jcenter()
}
}

  task clean(type: Delete) {
  delete rootProject.buildDir
 }

2 个答案:

答案 0 :(得分:2)

您可以在build.gradle

中添加以下行
android {
...
defaultConfig {
    ...
    multiDexEnabled true
    }
}

看看这个link

答案 1 :(得分:2)

最后我终于解决了我的问题,谢谢你的支持。这是我的Gradle文件。

build.gradle(模块:应用)

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
  }

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
 }
}
 apply plugin: 'com.android.application'
 apply plugin: 'io.fabric'
 apply plugin: 'com.google.gms.google-services'

repositories {
   maven { url 'https://maven.fabric.io/public' }
 }


android {
   compileSdkVersion 23
   buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.whyz.kitetech.mobile.cdrapp"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {

    debug {
        debuggable = true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
   }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true;
}
compile('com.digits.sdk.android:digits:1.9.4@aar') {
    transitive = true;
}

compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.firebaseui:firebase-ui:0.3.1'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.android.support:multidex:1.0.0'
compile 'org.apache.commons:commons-io:1.3.2'
}