spa*_*ron 17 android gradle android-studio
我有一个名为Common的库项目,我将其用于我的其他项目Consumer和Management共享的功能.消费者本身也是其他应用程序使用的库项目.
Common中的build.gradle文件包含其他项目使用的所有外部依赖项,如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
Run Code Online (Sandbox Code Playgroud)
这将下载以下库:
当我将Common添加到Consumer,Management或两者时,此列表保持不变.当我将Consumer添加到MyApp时,如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':consumer')
}
Run Code Online (Sandbox Code Playgroud)
有时候是这样的:
支持库刚刚消失,在我的项目中造成了彻底的破坏.这在更新到Android Studio 1.3.1之前没有发生,所以我真的想知道问题可能是什么.
作为参考,这些是完整的gradle.build文件:
共同
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 11
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.google.code.gson:gson:2.2.2'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
Run Code Online (Sandbox Code Playgroud)
管理
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "eu.test.mgmt"
minSdkVersion 11
targetSdkVersion 22
multiDexEnabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':common')
}
Run Code Online (Sandbox Code Playgroud)
消费者
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 18
versionName "1.3"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/xml', 'src/main/res/xml'] } }
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':common')
}
Run Code Online (Sandbox Code Playgroud)
MyApp的:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "eu.test.myapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 19
versionName "1.4"
multiDexEnabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':consumer')
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
672 次 |
| 最近记录: |