Android Studio 2.2 Duplicate files exception

349 views Asked by At

My gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.falcode.clientservertestapp"
        minSdkVersion 16
        targetSdkVersion 25
        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 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'org.apache.xmlrpc:xmlrpc-client:3.1.3'
}

Before I had error: "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: C:\Users\CeoFalcode.gradle\caches\modules-2\files-2.1\org.apache.xmlrpc\xmlrpc-client\3.1.3\e486ad917028b52265610206fb5a1e2b5914b94b\xmlrpc-client-3.1.3.jar File2: C:\Users\CeoFalcode.gradle\caches\modules-2\files-2.1\org.apache.xmlrpc\xmlrpc-common\3.1.3\415daf1f1473a947452588906dc9f5b3575fb44d\xmlrpc-common-3.1.3.jar"

I add some exclude line in packagingOne{}, but after I run into another error:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

and 82 lines report of error, where said "Recompile this lib from sources". I have no idea on how to solve this.

82 lines or errors:

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.XmlRpcCommonsTransport$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.XmlRpcCommonsTransport$1$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.XmlRpcCommonsTransport$1$2) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.XmlRpcLiteHttpTransport$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.util.ClientFactory$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.xmlrpc.client.XmlRpcClientWorker$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:trouble processing "javax/xml/parsers/DocumentBuilder.class":

Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)

Error:when not building a core library.

Error:This is often due to inadvertently including a core library file

Error:in your application's project, when using an IDE (such as

Error:Eclipse). If you are sure you're not intentionally defining a

Error:core class, then this is the most likely explanation of what's

Error:going on.

Error:However, you might actually be trying to define a class in a core

Error:namespace, the source of which you may have taken, for example,

Error:from a non-Android virtual machine project. This will most

Error:assuredly not work. At a minimum, it jeopardizes the

Error:compatibility of your app with future versions of the platform.

Error:It is also often of questionable legality.

Error:If you really intend to build a core library -- which is only

Error:appropriate as part of creating a full virtual machine

Error:distribution, as opposed to compiling an application -- then use

Error:the "--core-library" option to suppress this error message.

Error:If you go ahead and use "--core-library" but are in fact

Error:building an application, then be forewarned that your application

Error:will still fail to build or run, at some point. Please be

Error:prepared for angry customers who find, for example, that your

Error:application ceases to function once they upgrade their operating

Error:system. You will be to blame for this problem.

Error:If you are legitimately using some code that happens to be in a

Error:core package, then the easiest safe alternative you have is to

Error:repackage that code. That is, move the classes in question into

Error:your own package namespace. This means that they will never be in

Error:conflict with core system classes. JarJar is a tool that may help

Error:you in this endeavor. If you find that you cannot do this, then

Error:that is an indication that the path you are on will ultimately

Error:lead to pain, suffering, grief, and lamentation.

Error:1 error; aborting

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

0

There are 0 answers