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.
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
I searched alot but not found any solution of my problem, i tried to run my app on any device and i got this error:
it's throwing an error with com.github.bumptech.glide:glide:3.5.2 ,but it's used only single time how the classes of it got duplicate i run this app before with the same dependencies with out any trouble but suddenly this error appear while i run the app.
app.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "info.androidhive.firebase"
minSdkVersion 19
targetSdkVersion 25
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')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:design:25.1.0'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-storage:1.1.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.crystal:crystalrangeseekbar:1.1.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Browse to your project's "libs" directory and remove redundant "glide.x.x" which is causing the error due to redundancy.
Try putting this line :
enforceUniquePackageName false
after buildtoolVersion in your gradle
I am getting gradle issue .
here is below issue in gradle message, while doing sync in gradle
Our Android Studio version is 2.1.2.
Error:A problem occurred configuring project ':LetMeCall_Store'.
Could not find support-v4.jar (com.android.support:support-v4:24.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/24.1.1/support-v4-24.1.1.jar
Below is gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.app.letmecall.store"
minSdkVersion 15
targetSdkVersion 24
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:24.1.1'
compile 'com.android.support:design:24.0.0-beta1'
compile 'com.android.support:support-v4:24.0.0-beta1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.0.0-beta1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.daimajia.androidanimations:library:1.0.3#aar'
compile "com.google.android.gms:play-services:8.3.0"
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:multidex:1.0.0'
}
Plz anyone help us to fix that issue
Advance thanks
I upgraded all my Android SDK tools (including "Support Repository"), however, I still got the error
Gradle sync failed: Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:24.1.1)
I then did the following :
targetSdk 24 (was 23)
buildToolsVersion: "24.0.3" (was 24.0.0)
deleted the folders within /.gradle/caches I have windows and the complete path is C:\Users\USERNAME\.gradle\caches
THEN the project built without error !!
Change this
compile 'com.android.support:design:24.0.0-beta1'
compile 'com.android.support:support-v4:24.0.0-beta1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.0.0-beta1'
to this
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
you have to use same version.
Replace with these
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.stackdemo"
minSdkVersion 11
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.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.daimajia.androidanimations:library:1.0.3#aar'
compile "com.google.android.gms:play-services:8.3.0"
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:multidex:1.0.0'
}
I have the same issue and once i update Build tool version and android studio. Issue is resolved. Defiantly it is due to older build tool version.
I had this issue with a sample project from Android Developers. I updated all of the libraries in. the gradle file to latest versions then cleaned & rebuilt the project. All is working fine now.
Probably a good idea to make sure all of your sdk's are up to date too
when i import project eclipse to android studio. It make error about compile. I want to try fix follow: How to add Apache HTTP API (legacy) as compile-time dependency to build.grade for Android M? But it's not working. please help me!
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/annotation/GuardedBy.class
file build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "vae.vnsupermark.com"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled = true
// versionCode 1
// versionName "1.0"
ndk {
moduleName "vnsm"
}
}
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:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
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 'com.android.support:appcompat-v7:20.0.0'
// compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/error-reporter.jar')
//compile files('libs/httpclient-4.0.1.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
You should remove
compile fileTree(dir: 'libs', include: ['*.jar'])
because it will still compile the library (and all other jars in libs folder), as apparently it is not deleted from libs folder.
After this change, commenting out
//compile files('libs/httpclient-4.0.1.jar')
will really work as you expect :)
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.