问题来自于尝试编译android image picker项目时:
https://github.com/giljulio/android-multiple-image-picker.git
项目结构
multiple-image-picker -settings.gradle -build.gradle -example --build.gradle -picker --builid.gradle
settings.gradle:
include ':example', ':picker'
bulild.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
example的buid.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.giljulio.imagepicker:picker:0.1.0@aar'
}
picker的build.gradle
apply plugin: 'android-library'
apply plugin: 'maven'
group 'com.giljulio.imagepicker'
artifacts {
archives file('picker.aar')
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///your_path/your_home/.m2/repository")
pom.groupId = "com.giljulio.imagepicker"
pom.version = '0.1.0'
pom.artifactId = 'picker'
}
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
dependencies {
compile 'com.android.support:support-v13:+'
compile 'com.android.support:support-v13:18.0.+'
}
注意点:
1. mvn使用的是默认配置,即maven库位于默认用户的 .m2/repository下,没有修改setting.xml
2. gradle 文件增加了mavenLocal()
3. gradle文件增加相应mvn配置
4. 使用gradle uploadArchives 上传aar到本地mvn库,gradle uploadArchives --info(可查看信息)
5. gradle文件中引用方式为(并不特别):compile 'com.giljulio.imagepicker:picker:0.1.0@aar