java.util.zip.zipexception_java.util.zip.ZipException:重复条目:如何克服

我在我的项目中使用了多个Android库和模块.每个人都有自己的v4.Support lib.我收到java.util.zip.ZipException:重复条目.

?当我在项目中搜索重复的类文件时,由于每个库中有多个v4.support lib,因此这些类中有多个文件.我知道这个问题在这里被多次询问过,但没有什么对我有用.

我的问题是:如何删除这些多个v4.support文件?我想把这个v4.support lib只放一次,所有其他模块都应该从那里引用它.我该如何实现这一目标?

以下是我的build.gradle脚本

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {

mavenCentral()

maven { url 'https://maven.fabric.io/public' }

}

dependencies {

classpath 'com.android.tools.build:gradle:1.1.0'

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'

//classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'

classpath 'io.fabric.tools:gradle:1.15.2'

}

}

apply plugin: 'android'

apply plugin: 'com.android.application'

apply plugin: 'android-apt'

apply plugin: 'io.fabric'

repositories {

maven { url 'https://maven.fabric.io/public' }

}

dependencies {

compile fileTree(dir: 'libs', include: '*.jar')

compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {

transitive = true

}

compile('com.android.support:multidex:1.0.0')

//compile ('com.android.support:appcompat-v7:22.1.0')

compile project(':..:..:..:..:..:..:android_libraries:appcompat')

compile project(':..:..:..:..:..:..:android_libraries:facebook')

compile project(':..:..:..:..:..:..:android_libraries:google_play_services:libproject:google-play-services_lib')

compile project(':..:..:..:..:..:..:android_libraries:SlidingMenu')

compile project(':..:..:..:..:..:..:android_libraries:StickingGridViewLibrary')

compile project(':..:..:..:..:..:..:android_libraries:view_pager_library')

compile project(':..:..:..:..:..:..:android_libraries:ZXing2.3')

compile project(':..:..:..:..:..:..:android_libraries:xyz')

compile project(':..:..:..:..:..:..:android_libraries:apptentive')

}

android {

compileSdkVersion 21

buildToolsVersion "21.1.0"

defaultConfig {

versionCode 1

versionName "1.0"

minSdkVersion 15

targetSdkVersion 21

// Enabling multidex support.

multiDexEnabled true

}

compileOptions {

sourceCompatibility JavaVersion.VERSION_1_7

targetCompatibility JavaVersion.VERSION_1_7

}

ant.importBuild './../../../../../../buildscripts/wlbuild.xml'

apt {

arguments {

androidManifestFile variant.outputs[0].processResources.manifestFile

// if you have multiple outputs (when using splits), you may want to have other index than 0

resourcePackageName 'com.kohls.mcommerce.opal'

// If you're using Android NBS flavors you should use the following line instead of hard-coded packageName

// resourcePackageName android.defaultConfig.applicationId

// You can set optional annotation processing options here, like these commented options:

// logLevel 'INFO'

// logFile '/var/log/aa.log'

}

}

sourceSets {

main {

manifest.srcFile 'AndroidManifest.xml'

java.srcDirs = ['src']

resources.srcDirs = ['src']

aidl.srcDirs = ['src']

renderscript.srcDirs = ['src']

res.srcDirs = ['res']

assets.srcDirs = ['assets']

}

// Move the tests to tests/java, tests/res, etc...

instrumentTest.setRoot('tests')

// Move the build types to build-types/

// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...

// This moves them out of them default location under src//... which would

// conflict with src/ being used by the main source set.

// Adding new build types or product flavors should be accompanied

// by a similar customization.

debug.setRoot('build-types/debug')

release.setRoot('build-types/release')

}

buildDir = './../../../../../../build/native'

lintOptions {

abortOnError false

}

dexOptions {

incremental true

javaMaxHeapSize "4g"

}

packagingOptions {

exclude 'META-INF/LICENSE.txt'

}

}

我收到这样的错误.每次我清理项目时它都能顺利完成.但是当我尝试给出Run命令时,它会显示以下类型的错误.

Execution failed for task ':packageAllDebugClassesForMultiDex'.

> java.util.zip.ZipException: duplicate entry: android/support/v4/media/TransportMediatorCallback.class

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值