错误:任务执行失败 ':应用程序:transformResourcesWithMergeJavaResForDebug'。 > com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:重复文件 复制到APK META-INF / maven / org.jsoup / jsoup / pom.xml文件1: C:\用户\ G.gradle \缓存\模块-2 \文件-2.1 \ org.jsoup \ jsoup \ 1.8.2 \ 64238922c4006c3d0a9951c4c03983ecc6a1e1a0 \ jsoup-1.8.2.jar 文件2: C:\用户\ G变\ AndroidStudioProjects \ twrb \应用\建立\中间体\分解-AAR \ twrb \ webviewtimetablesearcher \未指定\罐子\ classes.jar
两个模块的build.gradle中的依赖关系,如下所示。
dependencies {
compile 'org.jsoup:jsoup:1.8.2'
}
这是app的build.gradle。
dependencies {
compile project(':moduleA')
compile project(':moduleB')
}
如何解决?感谢。
这是我的整个build.gradle app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test.tmp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
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'
exclude 'META-INF/maven/org.jsoup/jsoup/pom.xml'
exclude 'org/jsoup/nodes/entities-base.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
}
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'io.realm:realm-android:0.87.5'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'junit:junit:4.12'
compile project(':moduleA')
compile project(':moduelB')
}
答案 0 :(得分:3)
要解决此问题,您必须添加
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
build.gradle
中的