Duplicate entry error - JSONPath with GSON - android

I am using JSONPATH library with GSON
compile 'com.google.code.gson:gson:2.5'
compile 'com.jayway.jsonpath:json-path:2.1.0'
i have used these two libraries. When i build my project, it does not show any error. But when i run my project, it shows
Error:Execution failed for task '**:app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/objectweb/asm/AnnotationVisitor.class**" error.
Can anybody help me with this?
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName '0.2'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
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.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.jayway.jsonpath:json-path:2.0.0'
}
This is my build.gradle.
The problem is in libraries. It shows duplicate entry of a file.

Exclude the conflicting library, e.g.:
compile ('com.jayway.jsonpath:json-path:2.2.0') { exclude group: 'org.ow2.asm' }

Related

duplicate entry: com/google/android/gms/location/places/PlaceReport

i'm having a probleme when creating the APK
When i run the app, it works fine but when i build the apk it says
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/location/places/PlaceReport.class
gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
useLibrary 'org.apache.http.legacy'
configurations {
}
defaultConfig {
applicationId "inc.exemple"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.1gravity:android-rteditor:1.6.2'
compile 'com.github.irshulx:laser-native-editor:0.3.5'
compile 'com.github.arturogutierrez:badges:1.0.5#aar'
compile 'com.mikepenz:actionitembadge:3.3.1#aar'
compile 'com.mikepenz:iconics-core:2.8.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0#aar'
compile 'com.synnapps:carouselview:0.0.10'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
I believe i should exlude it, but i don't know how, please help, thank you.
So i had to create a new empty project and copy all the libs in it, and try one by one to find which one was containing the problem. the error was coming from the com.github.irshulx:laser-native-editor:0.3.5, it worked after i deleted it, then i modified the whole project and used another work around.

Run time gradle exception

I know this is a repeated question but I tried numerous code but couldn't solve the error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class
gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.cwish"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:recyclerview-v7:23.1.0#aar'
compile 'com.daimajia.numberprogressbar:library:1.2#aar'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.koushikdutta.ion:ion:2.+'
}
I guess this problem can be resolved by removing duplicate dependencies,before removing the duplicate dependencies, you should check your modules by this command:
gradlew -q dependencies yourProject:dependencies --configuration compile
refer to this answer:duplicate dependencies problem
Hope it can help you :)
Looks like duplicate dependency problem, remove "compile 'com.android.support:recyclerview-v7:23.1.0#aar" and it'll be fine.

OutOfMemory Error , Too much library files in Android Studio

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.

Android Parse.com - java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class

I have an app that works fine on the emulator but crashes on startup on the phone.
Am i right in saying i just extract the contents of the SDK folder into libs rather than have just one parse folder in libs with everything in it?
Gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aaa.bbb"
minSdkVersion 16
targetSdkVersion 19
versionCode 30
versionName "30"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
productFlavors {
}
defaultConfig {
multiDexEnabled true
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.+'
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
compile 'com.nononsenseapps:filepicker:+'
compile 'io.socket:socket.io-client:0.2.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.google.android.gms:play-services-analytics:7.8.0'
compile 'com.android.support:design:23.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
Log
:app:packageAllDebugClassesForMultiDex FAILED
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
One of your libraries is using different bolts library/classes so there is some duplicate. Please use ./gradlew yourModuleName:dependencies in terminal to check dependencies tree

java.util.zip.ZipException: duplicate entry: android/support/v7/view/ActionMode$Callback.class

i import one project in my Android studio so my build.gradle file as follows.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.pkg.name"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/ormlite-core-4.48.jar')
compile files('libs/google-play-services.jar')
compile files('libs/android-support-v7-appcompat.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
}
when i run my project it gives me error like below:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/view/ActionMode$Callback.class
Any idea how can i solve this problem? All your suggestions are appreciable.
You're including the appcompat library twice:
compile files('libs/android-support-v7-appcompat.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
Also please note that there are some other adjustments you need to make for multidex support: https://developer.android.com/tools/building/multidex.html

Categories

Resources