当我尝试使用android-maven-plugin构建Android应用程序时,我尝试了所有的广告方法来指定我的Android SDK的路径,但都不起作用。不管我做什么,当我跑步的时候
mvn clean install
我得到了
... Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
我将环境变量ANDROID_HOME设置为指向SDK的根目录,并将其导出。然后
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
...
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>19</platform>
</sdk>
...
</configuration>
</plugin>
不起作用。(我在SDK中安装了API 19 )
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
...
<configuration>
<sdk>
<path>/absolute/path/to/sdk</path>
<platform>19</platform>
</sdk>
...
</configuration>
</plugin>
不工作
<properties>
<android.sdk.path>/absolute/path/to/sdk</android.sdk.path>
</properties>
不起作用。和
mvn clean install -Dandroid.sdk.path=/absolute/path/to/sdk
不起作用。
我还尝试将SDK中的工具、平台工具和build- tools /19.1.1目录附加到$PATH,但也不起作用。aapt工具在我的路径上是可用的,但是maven插件拒绝查看它。我在网上搜索,我看到的唯一的建议是做我已经做过的事情。
我遗漏了什么?我是在OSX系统上这样做的。
发布于 2014-01-27 17:33:09
旧版本的Android Maven插件可能无法与最新的SDK一起工作。例如,在版本3.6.0中添加了对SDK 22的支持。检查changelog。
3.6.0
该插件已更新,可与SDK版本22.0一起使用。21.1在CI服务器上工作。它可能适用于旧版本,也可能不适用。
您不需要在pom.xml中配置ANDROID_HOME
,我的工作配置如下所示:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.2</version>
<configuration>
<sdk>
<platform>19</platform>
</sdk>
</configuration>
</plugin>
正确配置ANDROID_HOME
,对我来说,这指向
.../adt-bundle-linux-x86_64-20131030/sdk/
在调用maven之前,请确保它已正确配置。例如,只需运行echo $ANDROID_HOME
https://stackoverflow.com/questions/21374015
复制相似问题