maven android插件:找不到Android SDK路径 [英] maven android plugin:No Android SDK path could be found

查看:129
本文介绍了maven android插件:找不到Android SDK路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用maven-android-plugin版本3.3.2.当我尝试构建我的android项目时,出现以下异常:

I use the maven-android-plugin version 3.3.2. When I try to build my android project I have the following exception:

org.apache.maven.plugin.MojoExecutionException:找不到Android SDK路径.您可以使用<sdk><path>...</path></sdk><properties><android.sdk.path>...</android.sdk.path></properties>在pom文件的插件配置部分中进行配置,或者使用-Dandroid.sdk.path=...在命令行上进行配置,或者通过设置环境变量ANDROID_HOME

org.apache.maven.plugin.MojoExecutionException: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME

但是环境变量ANDROID_HOME设置为android sdk路径.

However environment variable ANDROID_HOME is set to android sdk path.

你能帮我吗?

推荐答案

听起来,虽然env var在您运行的shell上可用,但在Maven运行的shell上不可用.

It sounds like, while the env var is available on the shell you run, it isn't available on the shell Maven runs.

无论如何,最好不要使用该属性创建设置文件放.最少会有一个这样的样子(注销我的头顶,因为我现在没有可用的设置文件):

Regardless, instead of working around it, it's best to create a settings file with the property set. A minimal one would look like this (writing off the top of my head, as I don't have my settings file available now) :

<settings>
  <profiles>
    <profile>
        <id>android-settings</id>
        <properties>
            <android.sdk.path>/path/to/android/sdk</android.sdk.path>
        </properties>
    </profile>
  </profiles>
  <activeProfiles>
        <activeProfile>android-settings</activeProfile>
  </activeProfiles>
</settings>

将其扔到.m2文件夹中,或者通过Eclipse在Window-> Preferences...-> Maven-> User Settings中进行设置.

Throw it into your .m2 folder or set it via Eclipse in Window->Preferences...->Maven->User Settings.

这篇关于maven android插件:找不到Android SDK路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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