我有我的项目,其中包例如com.example.something,我将gradle lib项目添加到我的项目,我知道有相同的包。我尝试编译(项目(':插件机器人:应用')){ 排除组:'com.example.something' } 但它给出了错误: com.android.build.api.transform.TransformException:java .util.zip.ZipException:重复条目:如何在android studio中添加lib项目,但不包含特定的包?
是否有添加lib项目,同时排除该包及其下的所有java类?
这是LIB项目gradle这个
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.+' }
,这是例如我的项目gradle产出的
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "xxx.xxxx.xxxx"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
ndk {
moduleName "xxxxx-xxx"
}
}
dexOptions {
javaMaxHeapSize "2g"
preDexLibraries true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard.cfg'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard.cfg'), 'proguard-rules.txt'
}
debug {
jniDebuggable true
debuggable true
}
}
productFlavors {
emulator {
}
player {
}
}
sourceSets {
main {
jni {
}
}
emulator {
}
player {
}
}
}
dependencies {
compile "com.google.android.gms:play-services:8.1.0"
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile fileTree(dir: 'src/main/libs', include: ['*.jar'])
compile (project(':plugin-imagecode-android:app')) {
//trying to exclude package com.example.something from the lib project
}
}
你排除包或传递依赖? –
我想排除java包。我不太确定传递依赖是什么? –
据我所知,你不能以这种方式排除一个包裹。您只能排除依赖关系。 –