Android studio- Execution failed for task :app:dexDebug - android

> apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
defaultConfig {
applicationId "com.clickaley.eric.restaurants"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.2.4.jar')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.1'
compile 'com.squareup.retrofit:converter-jackson:1.9.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.github.jd-alexander:library:1.0.6'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.github.bmelnychuk:atv:1.2.+'
compile 'com.android.support:support-v4:23.0.0'
}
Can't figure out where is the problem.
* What went wrong:
Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

Here was the problem
Remove:
compile 'com.google.android.gms:play-services:7.8.0' And replacing it with:
compile 'com.google.android.gms:play-services-location:7.8.0' compile 'com.google.android.gms:play-services-analytics:7.8.0'

Related

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'on facebook accesstoken.class

I have been having some issues with this for a while
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/facebook/AccessToken$1.class
I do not know what to do, please help.
this is my build gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23"
aaptOptions {
useNewCruncher false
}
defaultConfig {
applicationId "com.example.dell.treblemusic"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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/LGPL2.1'
}
lintOptions {
abortOnError false
}
dexOptions {
incremental true
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/clink210.jar')
compile files('libs/eventbus-2.4.0.jar')
compile files('libs/picasso-2.5.2.jar')
compile project(':PayPalAndroidSDK-2.12.4')
compile 'com.google.android.gms:play-services-wallet:8.4.0'
compile 'com.stripe:stripe-android:1.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.stripe:stripe-java:1.37.1'
compile 'com.android.support:multidex:1.0.1'
compile project(':VisaCheckout-Android-SDK-2.9')
compile files('libs/card-io-5.1.1.jar')
compile files('libs/android-volley-1.0.10.jar')
compile 'com.pnikosis:materialish-progress:1.0'
compile files('libs/httpclient-4.2.4.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
compile files('libs/guava-13.0.1.jar')
compile project (':facebook-android-sdk-4.10.0')
compile 'com.android.support:cardview-v7:22.2.1'
}
You might be using different version of sample modules.
Please follow these steps
Add multidex in the gradle
In the module app gradle
android {
......
defaultConfig {
....
multiDexEnabled true
}
Added the dependency
compile 'com.android.support:multidex:1.0.1'
Add the facebook module and exclude dependent libraires
compile('com.facebook.android:facebook-android-sdk:$faceBookVersion') {
exclude group: 'com.android.support', module: 'multidex'
}
If You are using various Google play services like Location, Authentication etc, you should use same level of Libraries.
eg:
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:10.0.1'

How to fix java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class Android

I am getting this problem after replacing a .aar library with updated .aar.
Logcat
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
this is my gradle code.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "--Package-- Name--"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "0.0.5"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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/LGPL2.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.twitter.sdk.android:twitter:1.12.1#aar') {
transitive = true;
}
compile project(':cometchat-sdk')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mikhaellopez:circularimageview:3.0.1'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile 'com.google.android.gms:play-services-plus:9.0.1'
compile 'com.yqritc:recyclerview-flexibledivider:1.2.9'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1'
compile 'com.github.eneim:Toro:1.2.0'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'com.mcxiaoke.volley:library:1.0.17'
compile 'org.jsoup:jsoup:1.8.1'
compile 'org.apache.httpcomponents:httpcore:4.3.2'
compile 'org.apache.httpcomponents:httpmime:4.3.3'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
}

Execution failed for task : app:dexDebug

When I am running my android project I got the following error::
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_80\bin\java.exe'' finished with non-zero exit value 3
I tried Build->Clean Project but in vain.Alos i tried "Sync project with gradle files" but in vain .My build.gradle file is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.sevenhorse.almabay"
// Enabling multidex support.
multiDexEnabled true
minSdkVersion 14
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
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/LGPL2.1'
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.gson:gson:2.2.+'
compile files('libs/google-api-client-1.19.0.jar')
//compile files('libs/google-api-client-android-1.19.0.jar')
compile files('libs/google-api-services-youtube-v3-rev124-1.19.0.jar')
compile files('libs/google-http-client-1.19.0.jar')
// compile files('libs/google-http-client-android-1.19.0.jar')
compile files('libs/google-http-client-jackson2-1.19.0.jar')
compile files('libs/google-oauth-client-1.19.0.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/picasso-2.3.3.jar')
compile files('libs/universal-image-loader-1.6.1-with-src.jar')
compile files('libs/volley.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:multidex:1.0.0'
}
I have also done minifyEnabled true but not working.Please help me to fix the issue.
Don't include play services directly to build.gradle
compile 'com.google.android.gms:play-services:8.3.0'
Use only those modules of play services lib that you want for your application
For only GCM and Google Analytics for a app
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException:..non-zero exit value 3

After Clean Project -> Rebuild Project my android project I am getting below 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 '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 3
Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.myapplicationname.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile files('libs/gcm.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: "httpclient"
}
//facebook sdk
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
//facebook sdk
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
I already refer this , this , But I can't got my solution.What I need to do to resolve it.
I just update my gradle file like below.This work like charm!!
I added below code in my gradle:
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
My updated Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.myapplicationname.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
//====================Add below two line=============
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile files('libs/gcm.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: "httpclient"
}
//facebook sdk
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
//facebook sdk
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
The possible solution could be to specify play services you're using
compile 'com.google.android.gms:play-services:8.3.0'
for example like:
compile 'com.google.android.gms:play-services-maps:8.3.0'
It will decrease total methods amount.

Android Studio return jdk Error when trying to import GSON

My Android Studio returns this error when trying to import GSon 2.3.1 into my project:
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
I know that this occures everytime I have some duplicates of libraries or something.I already tried to add mavenCentral() to my Repositories
My full app 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'
}
Could you try adding this to your Gradle:
android {
....
dexOptions {
jumboMode = true
}
}

Categories

Resources