我用maven-android-plugin
版本 3.3.2。当我尝试构建我的 android 项目时,出现以下异常:
org.apache.maven.plugin.MojoExecutionException
: 找不到Android SDK路径。您可以使用 pom 文件中的插件配置部分来配置它<sdk><path>...</path></sdk>
or <properties><android.sdk.path>...</android.sdk.path></properties>
或在命令行上使用-Dandroid.sdk.path=...
或者通过设置环境变量ANDROID_HOME
然而环境变量ANDROID_HOME
设置为android sdk路径。
你能帮我么?
听起来,虽然环境变量在您运行的 shell 上可用,但在 Maven 运行的 shell 上不可用。
无论如何,与其解决这个问题,不如创建一个设置文件 https://maven.apache.org/settings.html与属性设置。最小的一个看起来像这样(写掉我的头顶,因为我现在没有可用的设置文件):
<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
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)