I am getting this error after gradle build :
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
My build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 022
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.prashant.nuhani_go"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':facebook')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.android.support:support-v4:22.2.1'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-api-client-android2-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/jackson-core-asl-1.9.4.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/android-google-maps-api13.jar')
}
From some of the answers regarding the same kind of error I came to know that i need to delete some jars from compile under dependencies.
Help me out to figure out which one to keep and which one to delete.
and also tell if there is any another solution for this problem.
Thanks
This error happens from compiling the same jar files more than once.. in this line:
compile fileTree(dir: 'libs', include: ['*.jar'])
you are telling your gradle project to compile all the jars in the lib folder.
In these lines:
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-api-client-android2-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/jackson-core-asl-1.9.4.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/android-google-maps-api13.jar')
You are once again telling the gradle project to compile various files in your libs folder. Remove the compile fileTree, or remove the compile files('libs/XXX') in order to fix this. With both remaining you will always get this error.
Related
I am trying to build an apk for my project in android studio 2.3.1 but I receive the error below:
Error:Execution failed for task ':Dr_Application:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error while executing java process with main class com.android.dx.command.Main with arguments
{--dex --num-threads=4 --multi-dex --main-dex-list C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\multi-dex\debug\maindexlist.txt --output C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\transforms\dex\debug\folders\1000\1f\main C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
my build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.bluehorntech.drapplication"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
}
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
compile files('libs/httpmime-4.1.3.jar')
compile 'com.android.support:multidex:1.0.1'
compile project(':datetimepicker-library')
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile files('src/libs/org.apache.http.legacy.jar')
// compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile project(':library')
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
// compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.jakewharton:butterknife:5.1.1'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.sendbird.sdk:sendbird-android-sdk:3.0.10'
/*ald*/
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0#aar'
}
apply plugin: 'com.google.gms.google-services'
I read and tried every possible solution from former threads but still cannot resolve my problem. Please help.
Use this build and clean project
Please help me to find a solution on this error.. When I build my project I got an error like this
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbq.class
Please check ones my build.gradle(App level) file... Please give me a hint to move farword
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.realmilk.app.new"
minSdkVersion 15
targetSdkVersion 25
versionCode 6
versionName "1.0.6"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':volley')
compile project(':materialviewpager')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'io.github.yavski:fab-speed-dial:1.0.3'
compile 'com.wdullaer:materialdatetimepicker:2.2.0'
compile 'com.jaredrummler:material-spinner:1.0.5'
compile 'it.neokree:MaterialTabs:0.11'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
testCompile 'junit:junit:4.12'
}
Please give me your valuable suggestions... Thanks
You are using 2 different versions of play service.
Change
compile 'com.google.android.gms:play-services-analytics:8.1.0'
to
compile 'com.google.android.gms:play-services-analytics:9.2.1'
So that both the auth and analytics service have same versions.
Similar question.
https://stackoverflow.com/a/38201741/3111083.
I have just added the paypal sdk and the following error occurred when building:
Error:Execution failed for task ':app:dexRelease'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
I have seen many threads suggesting that I add
multiDexEnabled true
but this does not work on api 18 and below. Also, It brings other errors with my facebook sdk.
Is there any other way I can handle this error?
Here's my build.gradle:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.edwardokoth.myapp"
minSdkVersion 15
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories { mavenCentral() }
dependencies {
compile files('libs/Parse-1.9.4.jar')
compile files('libs/ParseFacebookUtilsV4-1.9.4.jar')
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'commons-io:commons-io:+'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:0.6.3'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.android.support:design:22.2.1'
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
}
Check if there are libraries conflicts ( same library but different version ). In this case i supose you should exclude support library module from Facebook SDK.
compile ('com.facebook.android:facebook-android-sdk:4.6.0'){
exclude group: 'com.google.android', module: 'support-v4'
}
I am trying to implement tab view in my app. To do so I added the dependency
compile 'com.android.support:design:22.2.0'
This is my gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 16
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':lib_MaterialDesign_EditText')
compile project(':library_Android_Validator')
compile project(':lib_MaterialDesign')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.netflix.rxjava:rxjava-core:0.+'
compile 'com.netflix.rxjava:rxjava-android:0.+'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.google.android.gms:play-services-gcm:7.5.+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.android.support:design:22.2.0'
}
If I remove the line
compile 'com.android.support:design:22.2.0'
build is successful, so I guess the problem is with that line. Can someone please guide me. Thanks in advance !!
The error I get in gradle console is
Execution failed for task ':app_Architecture_Retrofit:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Administrator\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
I am getting same error every-time I add the following files in gradle.
Error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
renderscriptTargetApi 22
renderscriptSupportModeEnabled 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'])
compile 'com.google.android.gms:play-services:7.3.0'
compile project(':androidHorizontalListView')
compile 'com.ocpsoft:ocpsoft-pretty-time:1.0.6'
compile project(':httpclientandroidlib-1.1.2')
compile 'net.danlew:android.joda:2.7.2'
compile project(':facebook')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'
compile 'jp.wasabeef:recyclerview-animators:1.2.0#aar'
compile 'jp.wasabeef:picasso-transformations:1.0.5'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okio:okio:1.0.1'
}
I don't know how I can resolve the error.I really appreciate any help.
There has to be a jar file being compiled twice, either add each jar in your libs folder individually:
compile files('libs/yourjarfile.jar')
rather than:
compile fileTree(include: ['*.jar'], dir: 'libs')
or determine the file in your libs folder that is being compiled twice, and remove it keeping the fileTree compilation. Your best bet would probably be to do what I say with compiling each file individually, then looking to see the duplication in the gradle file
I think I also experienced similar problem.
You are using the latest appcompat-v7 22.2.1:
dependencies {
(...)
compile 'com.android.support:appcompat-v7:22.2.1'
(...)
}
Then maybe you should use the same version of CardView and RecyclerView.
dependencies {
(...)
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
(...)
}
At least for me this solution worked.
Remove all the jar files and dependencies and clean project .Now add one by one each jar file and also remove
compile fileTree(dir: 'libs', include: ['*.jar']) .Now Sync,clean and rebuild.Done.