NDK location not found - android

I get the error message "Error:Specified NDK location does not exists. Please ensure ndk.dir in local.properties file or ANDROID_NDK_HOME is configured correctly." when I try to run a sample android application from ARToolKit in Android Studio 2.2.2. This application has also parts (libraries) written in c++ which is why the NDK is necessary.
I have tried to set the environmental variable ANDROID_NDK_HOME and the property ndk.dir in the local properties file and I still get this message.
I installed the NDK using the built in SDK manager and it was correctly downloaded and installed at the location specified in the variable.
I use a Windows 7 64 bits computer and the target SDK version is 23.

you need to follow the instructions from here: http://artoolkit.org/documentation/doku.php?id=4_Android:android_native
In short:
From the android directory run ./build.sh that is how ARToolKit builds the native libraries for each example project. If you want to use the nativeExamples as well you need to run the ./build_native_examples.sh too.
Also, unfortunately, ARToolKit needs three different environment variables to be set. Two of them need to point to the NDK:
Set ANDROID_HOME to indicate the path to root folder of the downloaded Android SDK.
Set ANDROID_NDK_ROOT to indicate the path to root folder (most likely, “ndk-bundle”) of the downloaded NDK. The ANDROID_HOME environment variable can be used to help define NDK. ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle
Set NDK to the same path as ANDROID_NDK_ROOT. NDK=$ANDROID_NDK_ROOT
Set PATH to include a path to the ndk-build[.cmd] script file, that is, the path to the root folder of the NDK. The NDK environment variable can be used to help define the added path.
Please note that the variable is called ANDROID_NDK_ROOT not ANDROID_NDK_HOME.
Important:
As you are on Windows, you need to use the GitBash to run the *.sh scripts. The Windows command line does not have the commands used in the sh scripts, that is why you need to install and use GitBash.
That should you get going.
There is also the artoolkit.org/community/forum to help you along with questions.
Let me know if that helps.

Related

Mac Os ANDROID_NDK not set

I am trying to run the sample project of the following project: https://github.com/Shopify/react-native-skia
When I try to start it it gives me the following error message, it says ANDROID_NDK not set.
As you can see from the image android ndk is installed.
Where am I doing wrong?
From the README.md in this GitHub-project:
If you have Android Studio installed, make sure $ANDROID_NDK is available. ANDROID_NDK=/Users/username/Library/Android/sdk/ndk-bundle for instance.
If the NDK is not installed, you can install it via Android Studio by going to the menu File > Project Structure And then the SDK Location section. It will show you the NDK path, or the option to Download it if you don't have it installed.
So it seems that you need to create a environment variable called ANDROID_NDK which points to your NDK-installation.
Since I use Android NDK for my current project, I know this isn't setup automatically.
Environment variables on MacOS: https://support.apple.com/guide/terminal/use-environment-variables-apd382cc5fa-4f58-4449-b20a-41c53c006f8f/mac

Building Linphone: ERROR: The following binaries are missing: ndk-build. Please install them

I'm attempting to build the Linphone app, according the instructions here:
https://github.com/BelledonneCommunications/linphone-android
When I run prepare.py, I get the following error:
ERROR: The following binaries are missing: ndk-build. Please install them.
I have my path set to include the NDK folder. The problem is, there's no ndk-build.exe in that folder, or anywhere on my machine. There's a ndk-build.cmd file, but the prepare.py is specifically looking for ndk-build.exe.
I've downloaded and looked through android-ndk-r15c-windows-x86_64.zip, android-ndk-r16b-windows-x86_64.zip, android-ndk-r17c-windows-x86_64.zip and android-ndk-r18b-windows-x86_64.zip and none of them contain ndk-build.exe.
I know I'm missing something, I'm just not sure what it is.
Here's the line from prepare.py looking for ndk-build.exe:
ndk_build = find_executable('ndk-build')
Remember to set the environment variable ANDROID_HOME
Download the latest Android sdk with platform-tools and tools updated to latest revision, then add both tools and platform-tools folders in your path and the android-sdk folder to ANDROID_HOME environment variable.
Download the latest Android NDK from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable.

How to make Android Studio STOP generating local.properties?

I have set an environment variable ANDROID_HOME, which points to my android SDK location. However, every time I open my project in Android Studio it places local.properties file to the root of my project and copies my SDK location from ANDROID_HOME to this file. I want Android Studio use ANDROID_HOME directly, without generating local.properties.
Why? I'm on Windows 10 and I use Bash for Windows. I want to run command line using Bash while running Android Studio from Windows. For this I need two ANDROID_HOME environment variables, one for Windows, one for Bash. This is because although they point to the same (windows) android SDK the format is different, for Windows it is C:\Users\me\Android SDK while for Bash it's /mnt/c/Users/me/Android SDK. When Android Studio creates local.properties with windows path Bash becomes broken since apparently local.properties takes advantage over ANDROID_HOME, so I have to delete it manually.
You might find this article useful:
Posix path conversion (mingw.org)
The gradle android plugin "Application" extension
(your regular gradle-android interface) has a property
sdkDirectory. Perhaps this can override it? I can't check.
I think there is a configuration switch for bash on Windows to parse path separators Windows-like, can't seem to find it, it is buried deep inside MinGW or MSYS docs I think.
Last resort - git Hooks. Read the ProGit book chapter on Hooks.
The Android will generate this file always when gradle sync it. But if you delete it and define ANDROID_HOME and ANDROID_NDK_HOME environment variables, every time that generates it will read ANDROID_HOME and ANDROID_NDK_HOME.
If you want to build your project in many computers with different home folders, just keep the local.properties outside the source version control.

Do i need to install android NDK manually even after installing android NDK using SDK

When i try to use "ndk-build" i get following error
C:\Users\mack\AndroidStudioProjects\MyApplication>ndk-build 'ndk-build' is not recognized as an internal or external command, operable program or batch file.
Well after some research i found that ndk is not included in path folder of environment variables. Now when i check via SDK i can clearly see that i have checked and installed android NDK using the SDK of android studio, the path of which is
C:\Users\mack\AppData\Local\Android\sdk\ndk-bundle
and i even added this path to environment variables but no use. I am new to android so please pardon me if i am asking a dumb question. But its got me totally confused from like past couple of days.
Do i need to download and install android NDK manually from the link below and install it and then add it to environment variables-path?
I have also included the snapshotot folder contents from NDK installed using android SDK
What i can see from your error is that the PATH to the ndk-build may not be correct or that you do not have a runnable ndk-build file.
Are you sure that ndk-build.cmd is located inside of C:\Users\mack\AppData\Local\Android\sdk\ndk-bundle?
A solution to this can be to download the Windows 32-bit NDK package from Android NDK Download where the ndk-build file is runnable. And add the path to this folder to the

Building OpenCV 2.4.5 in android ADT: "ndk-build" not found in PATH

I'm trying to follow this OpenCV document to import OpenCV sample projects into the android ADT, and am getting the now infamous "Program "C:\android\android-ndk-r8d-windows\ndk-build" not found in PATH" error. My OS is Windows 7 and I use cygwin for any Linux-like commands.
Please note: I already downloaded the NDK package, and already set the value of NDKROOT to be my NDK root folder. I setup NDKROOT both as a system-wide environmental variable, and as an ADT's C/C++ Build environment variable, as shown below:
In my NDK root folder, I made identical copies of the file "ndk-build.cmd", and renamed them as "ndk-build" and "ndk-build.sh" respectively. I chmod+x to all three ndk-build* files.
Now what happens is really puzzling: If I specify the C/C++ Build command to be ${NDKROOT}/ndk-build or ${NDKROOT}/ndk-build.sh, I get the error "Program "C:\android\android-ndk-r8d-windows\ndk-build" not found in PATH". However, if I specify it to be ${NDKROOT}/ndk-build.cmd, ADT apparently finds it, but tries to run it as a Windows command, not as a bash script, as shown below:
The only way I can build a project, is to open a cygwin terminal, cd to the sample project folder, and run the script (either ndk-build or ndk-build.sh), like this:
I googled around for a solution. Although there are lots of "ndk-build.cmd not found in PATH" questions, I have not seen a case like mine. What is happening? I might also post my question to the openCV forum.
Apparently, the command that your Eclipse tries to run (when using the ${NDKROOT}/ndk-build.cmd version) is C:\\android\\android-ndk-r8d-windows\\ndk-build.cmd, which is apparently correct.
The problem is that your ndk-build.cmd is not a windows command file. And it should be. I just downloaded the Windows version of the ndk-r8e and the ndk-build.cmd file is copied here.
Try to download the ndk again or to modify your cmd file.
you should add the ${NDKROOT} variable (which is the folder in which the NDK is located) the same way you did with the PATH variable

Categories

Resources