1

I have developed an android project in android studio, but when I run the project I get this error:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: 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

So how can I get rid of this error?

This is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.abc.project1"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile files('libs/android-support-v4.jar')
    compile files('libs/mongo-2.10.1.jar')
    compile files('libs/org.apache.httpcomponents.httpclient_4.5.2.jar')
    compile files('libs/okhttp-3.2.0.jar')
    compile files('libs/org.apache.http.legacy.jar')
}
Sajal Ali
  • 427
  • 1
  • 10
  • 21

1 Answers1

1

You are adding the same dependencies twice.

Remove compile files('libs/android-support-v4.jar') from your build.gradle file.

Also delete the libs/android-support-v4.jar from your project (because with compile fileTree(dir: 'libs', include: ['*.jar']) you are adding it again.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841