Error in Gradle build: "java.exe finished with non-zero Exit value 2"

Asked

Viewed 689 times

0

I have this error in my Android Studio, this happens when I run an application I am developing. Does anyone know what it can be?

Log de build do Gradle

Follow my build.Radle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "android.com.br.apptoner"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/retrofit-2.0.0.jar')
    compile 'com.squareup.retrofit2:retrofit:2.0.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0'



    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}
  • Try adding this in the build.Gradle file: defaultConfig { multiDexEnabled true }

  • This error appeared after I put the command you suggested: "Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.Transform.Transformexception: java.util.zip.Zipexception: Duplicate entry: retrofit2/Builtinconverters$Bufferingresponsebodyconverter.class"

  • Post the build.Radle file.

  • @Geferson posted

  • First part of Gradle: apply plugin: 'com.android.application' android {
 compileSdkVersion 23
 buildToolsVersion "23.0.2"

 defaultConfig {
 applicationId "android.com.br.apptoner"
 minSdkVersion 16
 targetSdkVersion 23
 versionCode 1
 versionName "1.0"
 multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-Rules.pro' } } }

  • Replace this line : Compile files('libs/gson-2.3.1.jar') with this 'com.google.code.gson:gson:2.3.1' and remove this Compile files('libs/retrofit-2.0.0.jar'), see if it works. Don’t forget to clean up and build on the project.

  • Where I find the option to "clean and build" in android studio?

  • It is in the top bar the Build icon, but you can use the shortcut Ctrl+F9.

  • Related or not, it’s probably a good idea to install JDK 7, which is the largest version of Java with Android support.

  • I upgraded pro jdk8 thinking it might be problems in java, but I’ll still try JDK7 again.

  • I already have more than a week crashing with errors in this android studio, getting out of one problem and entering another. Meanwhile my project stopped.

Show 6 more comments

1 answer

0

Friend I have an app already in use in the play store and use this build.Radle apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "naovemaocaso.com.br
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 12
        versionName "2.0"

        //para atualizar a versao do app  basta mudar o version code
        //version name não precisa alterar   mas e ele que e exibido na play store
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile files('libs/GraphView-4.0.1.jar')
}

this last Compile and to generate graphics on android...
hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.