2016-08-09 11 views
2

私はAndroid上で自分のアプリを作成しようとしているが、私はアプリを実行しようとすると、私は次のエラーを取得するAndroidの重複ファイル/

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/services/com.fasterxml.jackson.databind.Module 
    File1: /home/eric/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.7.3/e41a3c103f5017794bd866528ec359ae70f5f875/jackson-datatype-jsr310-2.7.3.jar 
    File2: /home/eric/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.7.3/2390f30d097229e043a0bde30fa1ba8f9b0d951b/jackson-datatype-jdk8-2.7.3.jar 
    File3: /home/eric/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-guava/2.7.3/7fa709967be660a704d8b42e43d6811bf52a83fc/jackson-datatype-guava-2.7.3.jar 
    File4: /home/eric/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-afterburner/2.7.3/27b8222af569ecd9e718fa7e697fbb22045a98c4/jackson-module-afterburner-2.7.3.jar 

このエラーが駆動しています私の狂気、私は検索の多くをやったが、何も私のために働かない、男はpackagingOptionsを使用して、私は、例えば、このいずれかを試してみましたMETA-INFを除外示唆ほとんどの場合:

packagingOptions { 
     exclude 'META-INF/services' 
    } 

君たちは私を助けることができます? UPDATE

私はTMLの提案を追加して、今私は、次のエラー

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class 
Error:(org.dom4j.dom.DOMNodeHelper$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.dom4j.io.DocumentInputSource$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.dom4j.rule.RuleManager$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.dom4j.swing.LeafTreeNode$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.dom4j.swing.BranchTreeNode$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.dom4j.xpath.DefaultXPath$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: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process 
Information:BUILD FAILED 
Information:Total time: 19.099 secs 
Error:Error converting bytecode to dex: 
Cause: Dex cannot parse version 52 byte code. 
This is caused by library dependencies that have been compiled using Java 8 or above. 
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7' 
sourceCompatibility = '1.7' 
to that submodule's build.gradle file. 
Error:1 error; aborting 
+0

これは今全く別の問題です。あなたは新しい質問を始め、このオリジナルの質問に対する回答を受け入れるべきです。 – TWL

答えて

2

私はちょうどほぼ同じ問題を抱えていました。

は、このコードを追加し、TMLが言っただけのように、私のためにそれを解く:

android { 

    packagingOptions { 
     exclude 'META-INF/services/com.fasterxml.jackson.databind.Module' 
    } 

} 
0

使用buildTypes下記のおbuild.gradleファイルに次の行を取得しています: -
packagingOptions { exclude 'META-INF/NOTICE.txt' // will not include NOTICE file exclude 'META-INF/LICENSE.txt' // will not include LICENSE file } 同じファイルにdefaultConfigを追加する

multiDexEnabled true

これがあなたに役立つことを願っています。 これがあなたに有益な場合は、私に投票してください。

1

私は同様の問題を持つ人を助け:あなたはException: Duplicate files copied in APK BLAH/blaha.blahb.blahc

を見るたびに、あなたのケースでので、あなたの

に別のexclude 'BLAH/blaha.blahb.blahc'を追加Android Gradle Duplicate files copied in APK META-INF

を:exclude 'META-INF/services/com.fasterxml.jackson.databind.Module'

をこの例外が発生する可能性がありあなたがそれらすべてをキャッチするまで何度も!

+0

私はそれをしましたが、別のエラーが発生しました。私はスタックトレースで質問を更新しています。 –

関連する問題