NDK build error

10.8k views Asked by At

Hi I am new to Android NDK Development.

MacBook-Pro:JNIexample sk$ ndk-build
usage: dirname path
gmake: /Users/sk/build/core/build-local.mk: No such file or directory
gmake: *** No rule to make target `/Users/sk/build/core/build-local.mk'.  Stop.

Why do I get his error?

7

There are 7 answers

2
Ryan Reeves On

You need to specify the project you want to build. Like this: ndk-build -C location_of_project.

For example, to build the hello-neon sample that comes with the NDK you would go to your ndk install root and do ndk-build -C samples/hello-neon

2
mikerowehl On

The ndk-build tool is actually just a wrapper that calls gmake with the build-local.mk file. It finds the build-local.mk file by creating a relative path rooted at the location of the ndk-built tool. Sounds like you don't have the full NDK installed, or maybe moved the ndk-build tool without moving the rest of the NDK contents?

0
Saurabh On

So I was having the same trouble, and it looks like if I have any directory which is a part of full dir-path which has dir-name with space (' ') in between then 'ndk-build' wont be able to resolve paths. So my directory name "development tools" wasnt good enough so I changed it to "developmenttools" and it worked. If I hard-code the path in 'ndk-build' then it was working so found out the reason.

0
Hardik Joshi On

I also faced this problem. And i solved it and post entire answer here. I hope it helps you.

0
DYS On

Please notice that from the error message: gmake: /Users/sk/build/core/build-local.mk: No such file or directory.

The build/core/builid-local.mk is actually in the ndk's root directory, why is it listed as the /Users/username/build…?

I've encountered the same error on my Macbook. I've put the ndk inside /Applications/Android Studio.app directory, since there is a space between the name, somehow the tool in ndk can't resolve the implied path. That's why the error message is printed.

Later I renamed Android Studio.app to Android-Studio.app and thus resolved the issue.

0
elliptic1 On

The solution for me was different. If you look in the ndk-build script, you see it immediately runs `dirname $0` to get the directory to work in.

I was calling "ndk-build" from my command line, which was using a copy of the ndk-build script that I had put in /usr/local/bin/ and so my error was '/usr/local/bin/build/core/build-local.mk: No such file or directory'.

The solution is to be in the ndk folder where the real ndk-build script lives, and use the -C /path/to/project option to tell it where to start. So, 'cd /path/to/ndk' and then run './ndk-build -C /path/to/project'

0
tejasD On

I was having same problem. I created new workspace and import existing project to it. But forgot to add ndk location in windows->preferences->Android->NDK.