我想構建一個包含其他庫的android庫。我有2個這樣的工作區:打包android庫幷包含生成的aar中的其他庫
/workspace1
/libA
/myLib
/workspace2
/myApp
android庫myLib依賴於libA。
android應用程序myApp依賴於myLib(並使用來自libA的類)。
我想爲我的本地maven倉庫生成AAR for myLib(這沒關係)。但生成的AAR不包含來自libA的類和資源。
請參閱下工作空間1的的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
def groupVal = "com.mycompany.android"
def versionVal = "0.1-SNAPSHOT"
def compileSdkVersionVal = 19
def buildToolsVersionVal = "19.0.3"
def minSdkVersionVal = 10
def targetSdkVersionVal = 19
allprojects {
group = groupVal
version = versionVal
repositories {
mavenCentral()
mavenLocal()
}
}
project(':libA') {
apply plugin: 'android-library'
android {
compileSdkVersion compileSdkVersionVal
buildToolsVersion buildToolsVersionVal
defaultConfig {
minSdkVersion minSdkVersionVal
targetSdkVersion targetSdkVersionVal
versionCode 1
versionName versionVal
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
}
project(':myLib') {
apply plugin: 'android-library'
apply plugin: 'android-maven'
android {
compileSdkVersion compileSdkVersionVal
buildToolsVersion buildToolsVersionVal
defaultConfig {
minSdkVersion minSdkVersionVal
targetSdkVersion targetSdkVersionVal
versionCode 1
versionName versionVal
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile project(':libA') {
export = true
}
}
}
你有什麼建議嗎?
非常感謝,
利奧