Edit / Delete classes in external files of third-party jar libraries in android?

I use external third-party libraries in my project, but the problem I encountered is that two different jar files contain a class with the same name.

Below are the libraries that I use

  • jaxen-1,1-beta-2.jar
  • jaxen-core.jar

The above jar files share a class with the same name as " DefaultNavigator.class ", so because of this I get the following recurring class error .. p>

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org / jaxen / DefaultNavigator.class

I need to know if I can edit / delete unused classes or repetitive classes defined in external files of third-party third-party developers, or please guide me, can I copy only those classes that I required from all cans and put them in single jar file and use. if possible, tell me how to do it. I am starting an android. Below I attach the build.gradle file.

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.xxx.xxx.yyy"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'

}
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.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/xsdlib-1.5.jar')
compile files('libs/relaxngDatatype-2.2.jar')
compile files('libs/javax.xml.stream.jar')
compile files('libs/pull-parser-2.jar')
compile files('libs/javax.xml.bind.jar')
compile files('libs/java-rt-jar-stubs-1.5.0.jar')
compile files('libs/jaxen-core.jar')
compile files('libs/jaxen-dom4j.jar')
compile files('libs/jaxen-1.1-beta-2.jar')

}
+4
source share

Source: https://habr.com/ru/post/1666066/


All Articles