transformClassesWithJarMergingForDebug - java

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/github/mikephil/charting/animation/ChartAnimator.class
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.journaldev.navigationdrawer"
minSdkVersion 15
targetSdkVersion 23
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:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile project(path: ':MPChartLib')
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
}

Seems that you have problem related to the SDK cache.
Try the next step to "Refresh" your IDE (android studio)
1. Try - Choose File | Invalidate Caches/Restart.More information here

Related

Cannot Build release apk version

The Problem occur when i generate release version of the APK . I have already view this question and try all things mention but problem still exists Please point me in the right direction
Error
Error:Execution failed for
task:app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/design/widget/CoordinatorLayout$1.class
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.example.wildstone.cv_maker"
minSdkVersion 19
versionCode 1
versionName "1.0"
targetSdkVersion 27
multiDexEnabled true //important
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.itextpdf:itextg:5.5.10'
testCompile 'junit:junit:4.12'
}
This generally happens when you are using different versions of SDK and support libraries.
Replace the versions of these
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
to
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
and it should work.

Error: TranformException: java.util.zip.ZipException: duplicate entry:org/apache/http/HttpMessage.class error

In Android studio,for my preliminary test for my app, i build it. After gradle build success, when it is made to run, it throws an error,
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: org/apache/http/HttpMessage.class
my app:build.gradle file is
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.nxtgn.jaunt"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile files('libs/android-async-http-1.4.9.jar')
compile files('libs/httpclient-4.3.3.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
}
its hard for me to figure out my mistake. Please help me where I went wrong.
In terminal you need to execute in root project folder
./gradlew clean

Duplicated files copied in APK. Android

I'm trying to send a file to my Datastore of google. When I try to run the application I take the following error:
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK
com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt
File1:
C:\Users\Javier.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.28\bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d\appengine-endpoints-1.9.28.jar
File2:
C:\Users\Javier.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-api-1.0-sdk\1.9.34\7c15c22fd362478e9758081d28e51590304d5ff4\appengine-api-1.0-sdk-1.9.34.jar
I tried exclude the file with
packagingOptions {
exclude 'sep_approx_spanish.txt'
}
but it doesn't work. My Build.gradle is the next:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.javier.wh"
minSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'sep_approx_spanish.txt'
}
}
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.34'
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'
compile 'javax.servlet:servlet-api:2.5'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.guava:guava:19.0'
compile 'com.googlecode.objectify:objectify:5.1.12'
}
Someone had the same problem?
Help please!
Put below line in your app build.gradle inside android block
packagingOptions {
pickFirst 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt'
}

Error:Execution failed for task, duplicate entry

I have this error message:
Error:Execution failed for task ':app:packageAllReleaseClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$1.class
My build gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.doldurkazan.umutbahadir.sonolsun"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.android.support:appcompat-v7:22.0.0') {
exclude module: 'support-v4'
}
compile files('libs/android-async-http-1.4.8.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
}
Let me know how to resolve the issue.
This should hopefully work.... Make sure you remove the jar files from the libs folder as they will cause you problems. This now fetches the latest versions from maven
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.doldurkazan.umutbahadir.sonolsun"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile "com.android.support:support-v4:23.4.0"
compile 'com.loopj.android:android-async-http:1.4.9'
compile group: 'com.nostra13.universalimageloader', name: 'universal-image-loader', version: '1.9.5'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
testCompile 'junit:junit:4.12'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}
}
}
Why are you doing
compile files('libs/android-support-v4.jar')
instead of including the v4 support libraries the same way as you are adding appcompat??? This is a guaranteed way to create errors.
Try this instead
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.doldurkazan.umutbahadir.sonolsun"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/android-async-http-1.4.8.jar')
compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
testCompile 'junit:junit:4.12'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
you may or may not need to add
compile "com.android.support:support-v4:23.1.1"
All versions of the support libraries in use need to match, so you can mix a v23 and a v22 in the same project.
try removing this
compile ('com.android.support:appcompat-v7:22.0.0') {
exclude module: 'support-v4'
}
code and clean your project.it may help

Error:com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

This is my build.gradle
android {
...
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 23
versionCode 2
versionName "1.4.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile(name: 'identitytoolkit-api11', ext: 'aar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile ([group: 'com.google.api-client', name: 'google-api-client-android', version: '1.21.0'])
compile 'com.android.support:multidex:1.0.0'
}
I get this 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 2
I use google endpoints and I generate the API libraries using this doc.
And include the jar file to libs folder.
I get this error and I don't even know how to get more info and what to do to come over.
The solution:
android {
...
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 23
versionCode 2
versionName "1.4.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile(name: 'identitytoolkit-api11', ext: 'aar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile ([group: 'com.google.api-client', name: 'google-api-client-android', version: '1.21.0'])
}
In my case I just replaced
compile 'com.google.android.gms:play-services:8.3.0'
with
compile 'com.google.android.gms:play-services-maps:8.3.0'
because over 65K Methods were included.
Check multidexenable true in defaultconfig and have application class in you app and then --> extend it via MultidexApplication and use below line in your oncreate method of application:-
Multidex.install(this);
EDIT:-
--> also there is another line that if heapsize or gcoverhead exceeds issue occurs then below line will be usefull for you :-
dexOptions {
javaMaxHeapSize "4g"
}

Categories