我想将android库项目安装到本地Maven存储库。这是build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
apply plugin: 'maven'
version = "1.0.0-SNAPSHOT"
group = "com.example"
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 18
}
}
当我跑步时:
gradle install -i
它卡在这里:
Executing task ':project:installTest' due to:
Task has not declared any outputs.
Starting process 'command 'd:\android-sdk-windows\platform-tools\adb.exe''. Working directory: D:\Projects\java\....... Command: d:\android-sdk-windows\platform-tools\adb.exe install -r D:\Projects\java\.......\build\apk\project.apk
An attempt to initialize for well behaving parent process finished.
Successfully started process 'command 'd:\android-sdk-windows\platform-tools\adb.exe''
> Building > :project:installTest
因此,我注意到的第一件事是,由于某种奇怪的原因,它正在尝试将其作为APK部署在设备上。
我是在做错什么,还是只是android-library插件与maven插件不兼容?
编辑:请参阅github页面(https://github.com/dcendents/android-maven-gradle-plugin)了解最新说明,并找到要使用的正确版本。最新的gradle版本不再适合原始说明。
原始帖子:
我已经修改了Maven插件,使其与android库项目兼容。参见github上的项目:https : //github.com/dcendents/android-maven-gradle-plugin
配置您的android库项目以使用它:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
apply plugin: 'android-library'
apply plugin: 'android-maven'
然后,您应该能够使用安装任务将aar安装到本地maven存储库中。
希望这会有所帮助,如果您发现插件有问题,请在github上让我知道,我会修复它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句