I'm getting this error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/util/SortedList$BatchedCallback.class
here is my build gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.cuztomise.services"
minSdkVersion 11
targetSdkVersion 21
multiDexEnabled =true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
Use build took SDK V- 21 and java version 1_7 or below.
https://developer.android.com/about/dashboards/index.html
Are android apps backwards compatible?
Read this one very important:
Is it possible to use Java 8 for Android development?
Related
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.demo"
minSdkVersion 16
targetSdkVersion 21
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
aaptOptions
{
cruncherEnabled = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile project(':draggerLibrary')
compile project(':staggeredGridViewmaster')
compile files('libs/httpclientandroidlib-1.2.1.jar')
compile files('libs/httpcore-4.4-beta1.jar')
compile files('libs/httpmime-4.3.jar')
compile project(':viewPagerLibrary')
compile project(path: ':ViewPagerLibrary')
compile 'com.android.support:multidex:1.0.1'
compile 'joda-time:joda-time:2.4'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.google.guava:guava:20.0'
compile "com.daimajia.swipelayout:library:1.2.0#aar"
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
Error:Execution failed for task
':DemoProject:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/provider/DocumentsContractApi19.class
Configure your build.gradle .
Use
compileSdkVersion 25
buildToolsVersion "25.0.2"
Then
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.android.support:appcompat-v7:25.3.1'
For your MAP problem use getMapAsync()
SupportMapFragment mapOBJ = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map));
mapOBJ.getMapAsync(this);
Read Replace getMap with getMapAsync
Error:
Execution failed for task ':app:compileDebugJavaWithJavac'
This is my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.anees.aneesdawran.osyar"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
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 files('libs/universal-image-loader-1.9.0.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.github.moondroid.coverflow:library:1.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
open terminal(alt+F12) and print
./gradlew clean build --stacktrace --info
this will show what's the problem
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 developing a project, which uses a module(library project). Independently both are working fine, but when I am integrating both they starts to throw error in gradle build.
**Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.commom.process.ProcessException: org.gradle.process.internal.ExceException: Process 'command'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe" finished with non-zero exit value 2**
I have almost same import of library set in both the modules, because of security issues I needed to put these modules seperately.
Following are the build.gradle files for both
app : build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "*************************"
multiDexEnabled true
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/khandroid-httpclient-4.2.3.jar')
compile project(':library')
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup:otto:1.3.5'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'commons-codec:commons-codec:1.6'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
library : build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
multiDexEnabled true
minSdkVersion 14
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'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.squareup:otto:1.3.5'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'commons-codec:commons-codec:1.6'
}
I had already enabled multidexedenabled true .
Any help will be appreciable. Thanks
I solved this issue.Following are the steps I take:
1) In gradle.properties file of project un-comment the line
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
And write : org.gradle.daemon=true
2)In my project module app:build.gradle, I removed all the dependencies that has been there in library's build.gradle file.
Run the application by pressing returning this error:
Error:Execution failed for task ':myproject:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 3
My project has the lib facebook sdk and wheellib.
I realized that Android Studio is a long time processing the Gradle and after that displays this error and the application never starts (Run)
My gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId 'br.com.myproject'
minSdkVersion 19
targetSdkVersion 23
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':wheellib')
compile files('libs/comscore.jar')
compile files('libs/FlurryAnalytics-5.5.0.jar')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'joda-time:joda-time:2.4'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}
You must run this command at your terminal:
your-project-directory:$> gradle build --info --stacktrace
Then you will see the exactly moment that te gradle task fail.
I believe that the problem is that you are probably facing the 64k method limit.
i had this problem today too, it was in SDK that needs JDK 1_7 only ! I add it in gradle
compileOptions {
//noinspection GroovyAssignabilityCheck
sourceCompatibility JavaVersion.VERSION_1_7
//noinspection GroovyAssignabilityCheck
targetCompatibility JavaVersion.VERSION_1_7
}
then change yours HOME_JAVA on computer to JDK version 1_7 and change Java version in Android Studios Project structure to 1_7 that is all i do.
You may just check compatibility all yours JDK requirements or it may be 64+ methods problem too...
I changed my build.gradle and work! Added dexOptions:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId 'br.com.myproject'
minSdkVersion 19
targetSdkVersion 23
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
//noinspection GroovyAssignabilityCheck
sourceCompatibility JavaVersion.VERSION_1_7
//noinspection GroovyAssignabilityCheck
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile project(':facebookSDK')
compile project(':wheellib')
compile files('libs/comscore.jar')
compile files('libs/FlurryAnalytics-5.5.0.jar')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'joda-time:joda-time:2.4'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}