本文介绍了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:

但是环境变量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路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 07:24