设置环境变量`ANDROID_NDK_HOME`

时间:2015-12-06 11:56:26

标签: android maven android-ndk

我正在使用macbook。我已下载Android NDK&将其提取到

~/mytool/android-ndk-r10e

.bash_profile 中,我设置了:

export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_NDK_HOME = ~/mytool/android-ndk-r10e

我的项目pom.xml包含以下插件:

<plugin>
   <groupId>com.simpligility.maven.plugins</groupId>
   <artifactId>android-maven-plugin</artifactId>
   <version>4.3.0</version>
   <extensions>true</extensions>
</plugin>

当我运行mvn clean install时,出现以下错误:

[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.3.0:ndk-build (default-ndk-build) on project MyTrackor: No Android NDK path could be found. 

You may configure it in the pom using <ndk><path>...</path></ndk> or <properties><ndk.path>...</ndk.path></properties> or on command-line using -Dandroid.ndk.path=... or by setting environment variable ANDROID_NDK_HOME -> [Help 1]

上述错误表示没有找到Android NDK路径,它建议我设置环境变量ANDROID_NDK_HOME来解决问题。

但正如您在 .bash_profile 中看到的那样,我已经设置了envrionment变量ANDROID_NDK_HOME。为什么我仍然会收到此错误?

1 个答案:

答案 0 :(得分:2)

使用line命令验证所有导出的变量

export 

如果你没有看到ANDROID_NDK_HOME,那意味着你的bash文件还没有重新加载。那么

source .bash_profile to reload the config. 

否则你看到ANDROID_NDK_HOME,可能是另一个问题。