问题
I am trying to install VS2015 preview to see how to develop a c++ android app.
The online secondary installer is very slow so I cancelled it and tried to install the tools separately one by one. It seemed to be OK.
Then I created a c++ project for android and tried to compile it, but I got an error:
1>------ Build started: Project: Android1.NativeActivity, Configuration: Debug ARM ------
1> ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
1> ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3\
1> JAVA_HOME="C:\Program Files (x86)\Java\jdk1.8.0_25"
1> NDK_ROOT=
1>TRACKER : error TRK0005: Failed to locate: "clang.exe". The system cannot find the file specified.
I guess the problem is that NDK_ROOT
is empty, but I have installed the NDK and defined NDK_ROOT
manually in windows system environment variables.So I guess it needs to defined somewhere else, maybe in the registry?
Anyone with a successful VS2015 c++ android environment could check where NDK_ROOT
is defined in your system?
Thanks
回答1:
Go to Visual Studio 2015/Tools/Options/Cross Platform/Android et set folders for : Android SDK, Android NDK, Apache Ant, Java JDK.
回答2:
I wanted VS to use my existing Android tools and changing string key 'NDK_HOME' at 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\Setup\VS\SecondaryInstaller\AndroidNDK' did the trick.
Maybe you can add it manually.
回答3:
You need to set environment variables "NDKROOT" rather than "NDK_ROOT",and the variables's value is your real ndk path
回答4:
If you don't have Android tools installed already, go to Programs and Features and find Microsoft Visual Studio 2015 Preview Secondary Installer, select it and click Change. When it brings up a list of secondary tools to install, there's no need to change the defaults that are selected. Just click Next and then Install.
After you do that your project will find clang and build correctly.
来源:https://stackoverflow.com/questions/27088069/vs2015-preview-ndk-root-is-not-defined