NDK build error

2019-01-26 11:31发布

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条回答
等我变得足够好
2楼-- · 2019-01-26 11:51

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.

查看更多
该账号已被封号
3楼-- · 2019-01-26 11:58

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

查看更多
虎瘦雄心在
4楼-- · 2019-01-26 11:58

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.

查看更多
Root(大扎)
5楼-- · 2019-01-26 12:02

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?

查看更多
姐就是有狂的资本
6楼-- · 2019-01-26 12:03

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

查看更多
Juvenile、少年°
7楼-- · 2019-01-26 12:04

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'

查看更多
登录 后发表回答