摇篮Maven插件"安装"任务不与Android库项目工作 [英] Gradle Maven plugin "install" task does not work with Android library project

查看:165
本文介绍了摇篮Maven插件"安装"任务不与Android库项目工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要安装的Andr​​oid库项目,以本地Maven仓库。 这里是 build.gradle 的:

I want to install android library project to local maven repository. Here is 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

它被困在这里:

it gets stuck here:

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上部署它。

So first thing I noticed is that it's trying for some odd reason to deploy it on a device as APK.

我是不是做错了什么或只是机器人库插件不能与Maven插件?

Am I doing something wrong or is it just android-library plugin not compatible with maven plugin?

推荐答案

编辑:请参阅GitHub的页面(的 https://github.com/dcendents/android-maven-gradle-plugin )的最新指示,并找到正确的版本才能使用。原始指令不适合再使用最新摇篮释放

Please refer to the github page (https://github.com/dcendents/android-maven-gradle-plugin) for the latest instructions and find the correct version to use. The original instructions are not suitable anymore with the latest gradle release.

原贴:

我已经修改了Maven插件是与Android库项目兼容。查看GitHub上的项目: https://github.com/dcendents/android-maven-gradle -plugin

I've modified the maven plugin to be compatible with android library projects. See the project on github: https://github.com/dcendents/android-maven-gradle-plugin

配置您的Andr​​oid库项目使用它:

Configure your android library projects to use it:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.github.dcendents:android-maven-plugin:1.0'
    }
}

apply plugin: 'android-library'
apply plugin: 'android-maven'

然后,你应该能够使用安装任务来安装AAR到你的本地仓库。

Then you should be able to install aar into your local maven repository using the install task.

希望这会有所帮助,如果你发现问题的插件,请让我知道在GitHub上,我会解决它。

Hope this helps, if you find issues with the plugin please let me know on github and I'll fix it.

这篇关于摇篮Maven插件"安装"任务不与Android库项目工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆