Android的Maven插件没有得到ANDROID_HOME ENV变量在Eclipse变量、插件、Maven、Android

2023-09-06 03:12:11 作者:悲徒

我工作的一个Android应用程序的项目,这是一个Maven项目。 当我尝试运行的行家安装这是我所得到的:

i'm working on an Android app project and it is a Maven project. when i try to run as "maven install" this is what i get:

无法执行的目标com.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.1.1:产生-人士预期Android的客户端(默认生成-源):没有Android SDK中的路径。可以发现你可以将它配置使用POM文件的插件配置一节...或者...或者在命令行使用-Dandroid.sdk.path = ...或通过设置环境变量ANDROID_HOME - > [说明1]

"Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project android-client: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using ... or ... or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME -> [Help 1]"

如果我硬code我android_home路径到pom.xml中,它工作正常,但我们使用git,每个人都可能有android_home.why不同的路径没有Android的Maven的插件得到ENV变量在Eclipse?

if i hardcode my android_home path into pom.xml,it works fine but we use git and everyone may have different paths for android_home.why doesn't android-maven-plugin get env variable in eclipse?

android_home ENV变量在我的道路。 我写在我的pom.xml $ {env.ANDROID_HOME},但它仍然没有奏效。

android_home env variable is in my PATH. i wrote ${env.ANDROID_HOME} in my pom.xml but it still didn't work.

奇怪的是,如果我使用的终端(MVN安装)作为Maven的安装运行,它的作品!

strangely,if i use terminal (mvn install) to run as maven install,it works!

其实这是对我来说很可选的问题,但我还是想知道为什么这个插件并不在Eclipse工作。

actually this is quite optional problem for me but still i want to know why this plugin does not work in Eclipse.

推荐答案

您需要创建ANDROID_HOME一个系统变量,而不是将其设置在路径中。

You need to create a system variable for ANDROID_HOME, not set it in your PATH.