我有我的項目,其中包例如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包。我不太確定傳遞依賴是什麼? –
據我所知,你不能以這種方式排除一個包裹。您只能排除依賴關係。 –