Reputation: 1857
I am trying to solve one problem for a few days.
When I run my app, I get this error:
Error:java.io.IOException: Duplicate zip entry
[simple-xml-2.7.1.jar:org/simpleframework/xml/Attribute.class]
And In more detail (here It says : simple-xml-2.7.1.jar but I have simple-xml-2.3.4.jar like in the image)
Error:java.lang.RuntimeException: java.io.IOException: Can't write [C:\Users\Alfonso\Documents\AndroidStudioProjectsNew\Business\VOIPMonitoring\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\Alfonso\.gradle\caches\modules-2\files-2.1\org.simpleframework\simple-
xml\2.7.1\dd91fb744c2ff921407475cb29a1e3fee397d411\simple-xml-2.7.1.jar(;;;;;;**.class)]
(Duplicate zip entry [simple-xml-2.7.1.jar:org/simpleframework/xml/Attribute.class]))
Caused by: java.io.IOException: Duplicate zip entry [simple-xml-2.7.1.jar:org/simpleframework/xml/Attribute.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:184)
Associated Proguard files are empty.
After the comand: gradlew clean I get:
Here where is the library (I am using external library )
My Progect build.gradle:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://dl.bintray.com/httprequester/maven" }
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My Module: android-ngn-stack build.gradle
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://dl.bintray.com/httprequester/maven" }
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My module:app build.gradle where i think there is the problem
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "monitoring.voip.business.tim.voipmonitoring"
minSdkVersion 19
targetSdkVersion 24
multiDexEnabled true
versionCode 3
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':android-ngn-stack')
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.google.firebase:firebase-config:11.0.4'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(path: ':librarynetwork')
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:animated-vector-drawable:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:mediarouter-v7:25.4.0'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true;
}
compile 'com.getkeepsafe.taptargetview:taptargetview:1.10.0'
compile 'com.pnikosis:materialish-progress:1.7'
compile 'com.loopeer.library:cardstack:1.0.2'
compile 'com.github.aakira:expandable-layout:1.4.2@aar'
// Room
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
compile 'ir.bpadashi.requester:requester:1.1.6'
compile 'com.google.code.gson:gson:2.8.2'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.0.0'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 0
Views: 2585
Reputation: 1857
After days, I solved my problem starting with a new project and adding incrementally dependencies
The problem was caused from dependencies into my gradle file in conflict with my external library.
I discovered this thanks the command
./gradlew app:dependencies > dependencies.txt
where app is your project module.
The conflict problem are localized where you see the arrow (-->) .
You can exclude that dependency using "exclude module" like below (but I have prefered starting from new empty project and I will exclude dependencies problems after )
As an example, lets say that com.android.support:support-v4 is the module with the duplicate classes that are causing these errors. Here's how to exclude that duplicate module from your dependency:
//Your dependency that includes the module with the duplicates.
compile('com.my.project:my-module:0.1') {
//exclude the offending module so there won’t be duplicates.
exclude module: 'support-v4'
//maybe you need to exclude a group also?...
exclude group: 'com.google.android.gms'
}
references to same solution
Upvotes: 0
Reputation: 191983
simple-xml-2.7.1.jar but i dont't use it..
You may not, but one of those other libraries does
Simple XML JAR is not a JNI library, so I don't know why you'd put it in jniLibs
, but...
Delete your JAR, use this dependency instead
compile 'org.simpleframework:simple-xml:2.7.1'
Upvotes: 0
Reputation: 1153
This is probably your problem. You put simple-xml-2.3.4.jar
in your dependencies and some of your other dependencies have dependency on simple-xml-2.7.1.jar
.
Use ./gradlew <module-name>:dependencies | grep simple-xml
to find out if this is the case and search for dependency that uses it.
It would be best for you to try compiling without simple-xml-2.3.4.jar
and see if code runs with simple-xml-2.7.1.jar
.
Upvotes: 1