尝试导入GSON时,Android Studio返回jdk错误

时间:2015-07-09 20:40:50

标签: android

尝试将Android Studio导入我的项目时,我的GSon 2.3.1会返回此错误:

Error:Execution failed for task ':app:dexDebug'.
> 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 2

我知道每当我有一些重复的库或其他东西时就会发生这种情况。我已经尝试将mavenCentral()添加到我的Repositories

我的完整应用Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.marian.stream"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile("org.restlet.jse:org.restlet.ext.httpclient:2.1.2") {
        exclude group: 'org.restlet', module: 'jse'
        exclude group: 'org.restlet.ext', module: 'ss1'
    }

    android {
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/ASL2.0'
            exclude 'META-INF/services/org.restlet.engine.ClientHelper'
        }
    }
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'net.koofr:java-koofr:1.2.8'
    compile 'org.apache.httpcomponents:httpclient:4.3.5'
    compile 'org.restlet.jse:org.restlet.ext.jackson:2.1.2'
    compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.3'
    compile 'com.rengwuxian.materialedittext:library:1.8.3'
    compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
    compile 'com.google.android.gms:play-services:7.0.0'
    compile 'com.android.support:recyclerview-v7:21.0.+'
    compile project(':..:vector-compat-master:library')
    compile 'com.baoyz.pullrefreshlayout:library:1.0.1'
    compile('com.mikepenz:materialdrawer:3.0.9@aar') {
        transitive = true
    }
    compile 'com.github.bmelnychuk:atv:1.2.+'
    compile 'com.google.code.gson:gson:2.3.1'
}

1 个答案:

答案 0 :(得分:0)

您可以尝试将其添加到您的Gradle:

android {

    ....

    dexOptions {

        jumboMode = true
    }
}