duplicate entry AbsHListView in my Android Project - android

I am working on one android application, where i am using two libraries ( Aviary android sdk and PrintIO sdk)
Getting conflict in libraries and getting this error each time when compiling project :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: it/sephiroth/android/library/widget/AbsHListView$1.class
I have not used such library anywhere in my project as well as i also checked in both libraries, but not found anything.
Please anyone suggest me anything why i am getting this conflict in my project?
EDIT :
Here is my build.gradle file :
apply plugin: 'com.android.application'
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven {
name 'maven.aviary.com'
url uri("http://maven.aviary.com/repo/release")
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
lintOptions {
disable 'MissingTranslation'
}
defaultConfig {
applicationId "XXXXX.XXXXX"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
multiDexEnabled true
}
packagingOptions {
exclude 'lib/armeabi-v7a/librsjni.so'
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'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/httpclient-4.0.1.jar')
compile files('libs/httpcore-4.0.1.jar')
compile project(':MaterialDialog')
compile files('libs/universal-image-loader-1.9.1.jar')
compile project(':StaggeredGrid')
compile project(':CustomFloatingButtonLibrary')
compile files('libs/dropbox-android-sdk.jar')
compile files('libs/gcm.jar')
compile project(':image_select_lib')
compile files('libs/json-simple-1.1.1.jar')
compile project(':chipsLib')
compile files('libs/aws-android-sdk-1.4.3-s3.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.instabug.library:instabugsupport:1.+'
// compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'
compile 'com.yalantis:phoenix:1.2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile project(':Aviary-SDK')
compile project(':SwipyLib')
compile project(':printio')
}
EDIT 2 :
I searched for library (AbsHListView) using CTRL + N and it result in following :

I did a google search for the class it/sephiroth/android/library/widget/AbsHListView$1.class and found out it is used by the library here.
Looks like one of your dependencies is using this library. If you are on Windows press CTRL + N and enter this AbsHListView and search. You will find the conflicting class.
EDIT:
Change your dependency like this:
compile project(':printio') {
exclude group: 'it.sephiroth.android.library.widget'
}

Related

Update plugin error

I'm new to android, so please bear with me if my question is stupid.
I have an android project built in older version of gradle. The app works fine when modifying code in existing activities, but whenever I create a new activity, I get the following error:
Error:(77, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
Upgrade plugin to version 3.0.1 and sync project
Show in File
Show in Project Structure dialog
This is the content of app level gradle file:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias ''
keyPassword ''
storeFile file('')
storePassword ''
}
}
compileSdkVersion 27
buildToolsVersion "23.0.2"
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'
}
defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
}
productFlavors {
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
//Fast and simple data storage library for Android
// compile project(':squarecamera')
// compile 'com.github.boxme:squarecamera:1.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.6'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'io.paperdb:paperdb:0.9'
compile 'com.fabiendevos:nanotasks:1.1.0'
compile 'com.flipboard:bottomsheet-core:1.5.0'
compile 'com.flipboard:bottomsheet-commons:1.5.0'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile project(':squarecamera')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
This is my project level gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
And my android studio version is 3.0.1.
When I update the plugin, I get a lot of compatibility issues.
Please help me resolve this. Thanks in advance!

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'

Build APK error?

I tried to build apk it comes out this. What should I do? Please help!!
I don't where is the problem. The project is fine when I build the project, but it come error when I build apk.
Error:Execution failed for
task':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Here is the gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'com.androidbelieve.SeeDate'
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
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'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:10.0.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'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:support-v4:22.2.1'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebaseui:firebase-ui:0.6.0'
}
apply plugin: 'com.google.gms.google-services'
gradle project
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Did you tried Build/Clean Project in Android Studio Menu
Which dependency does the app:transformClassesWithJarMergingForDebug come from? Maybe you should modify that dependency's version number to be consistent with the major sdk version.

Updated Android Studio, receiving DuplicateFileException

I just updated Android Studio and I cannot build my app after doing so. I receive an exception looking like this:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: /Users/andersvincentlund/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.2.2/d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b/jackson-core-2.2.2.jar
File2: /Users/andersvincentlund/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.2.2/3c8f6018eaa72d43b261181e801e6f8676c16ef6/jackson-databind-2.2.2.jar
File3: /Users/andersvincentlund/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.2.2/285cb9c666f0f0f3dd8a1be04e1f457eb7b15113/jackson-annotations-2.2.2.jar
I have googled this type of error and have been suggested to add:
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '...'
}
in the android clause in gradle. This changes nothing(except makes my build potentially illegal since I would be ignoring licensing for OS code?). Does anyone have an idea on how to solve this? I was hoping an update would not break the code.
EDIT:
I got a comment regarding gradle file so I am posting the entire thing below:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
signingConfigs {
config {
keyPassword 'XXXXX'
storeFile file('/XXXXX/XXXXX/XXXXX/android.keystore')
storePassword 'XXXXX'
keyAlias 'XXXXX'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "XXXXX"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.config
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
apt 'com.google.dagger:dagger-compiler:2.5'
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.dagger:dagger:2.5'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.firebaseui:firebase-ui:0.3.1'
compile 'com.firebase:firebase-client-android:2.4.0'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
}
apply plugin: 'com.google.gms.google-services'
Just Remove:
compile fileTree(include: ['*.jar'], dir: 'libs')
from
dependencies {}
The jackson-core-2.2.2.jaris already present in your libs/ but another dependency is trying to add it again externally.
Please add below line
packagingOptions {
exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'
exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'}

Can't add xstream 1.4.8 dependency to Android using gradle

I'm having difficulties with including xstream library to my Android gradle-based app. From what I've read in xstream documentation, it should work "out of the box". However, when I add dependency:
compile 'com.thoughtworks.xstream:xstream:1.4.8'
I get following exception during build process:
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/xmlpull/v1/XmlPullParser.class
Ok, so maybe I should exclude xmlpull? I tried changing this dependency to:
compile ('com.thoughtworks.xstream:xstream:1.4.8') {
exclude group: 'xmlpull', module: 'xmlpull'
}
And, as a result, after some time:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
// ...
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
// ...
1 error; aborting
I've also checked project dependencies using gradle dependencies, but found nothing xml-related there.
My whole build.gradle file:
group 'myGroup'
version '1.0'
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "edu.foo.app"
minSdkVersion 19
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'
}
}
repositories {
mavenCentral();
maven {
url 'https://repository-achartengine.forge.cloudbees.com/snapshot/'
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':Commons')
compile 'commons-io:commons-io:2.4'
compile 'commons-codec:commons-codec:1.10'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'org.achartengine:achartengine:1.2.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.thoughtworks.xstream:xstream:1.4.8'
// compile ('com.thoughtworks.xstream:xstream:1.4.8') {
// exclude group: 'xmlpull', module: 'xmlpull'
// }
}
What should I do to include xstream library to my project?
Solution was to downgrade xstream to v1.4.7 and exclude xmlpull.
compile ('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}
I don't know exactly why, but I'd guess that it must be java8-related.
I was getting the same Error.What i did, i just Disable the "Enable all the test artifacts" from my default preferences.
and Open build variants select unit tests..
Hope above Ans may helps any one.

Categories

Resources