[英]Adding dependencies to my project when my AAR already contains them
当我的AAR库已经使用那些依赖项时,为什么gradle迫使我将依赖项添加到主模块中?
例:
我的AAR库gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:design:22.2.1')
compile('com.android.support:appcompat-v7:22.2.1')
compile('com.android.support:cardview-v7:22.2.1')
compile('com.android.support:recyclerview-v7:22.2.1')
compile('de.greenrobot:eventbus:2.4.0')
}
我的应用程式gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.firetrap.blaap"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('my_package_name:channels.base@aar')
}
为什么我不能使用AAR中的com.android.support:cardview-v7:22.2.1
?
这是因为您的班级文件不会被带入您的aar的dex。 但是我认为您寻求解决方案不是您问题的答案。 一个解决方案可能是提取并下载aar并将其包含在您的库中,我认为这会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.