ndk-build not found as a command
Solution 1
Guess that should have been an answer instead of a comment.
You must use Cygwin as your shell in order to run ndk-build.
See http://www.cygwin.com/
Solution 2
Once you have Cygwin installed you can have Eclipse automatically build your project for you by:
Right click on your project, pick properties.
Select "builders" from the left-hand list.
Click "New..." on the right side.
-
Select "Program" as the configuration type. I name mine "Native Builder"
Location - c:\cygwin\bin\bash.exe
Working Directory - c:\cygwin\bin
Arguments -
(for NDK r3): --login -c "cd /cygdrive/c/Android_NDK && make APP=myapp"
(for NDK r4): --login -c "cd /cygdrive/c/ && /cygdrive/c/Android_NDK/ndk-build"
Make sure you have the two hyphens before login and the quotes after the hyphen-c
Now go to the refresh tab
Check "Refresh resources upon completion"
Select "Specific resources"
Click on the "Specify resources" button and select your project's lib directory.
Check "Recursively include sub-folders"
Now go to the build options tab
Check "Allocate Console"
Check "Launch in background"
Check "Run the builder After a Clean"
Check "Run the builder During manual builds"
Check "Run the builder During auto builds"
Check "Specify working set of relevant resources"
Click on "Specify Resources"
Select your project's JNI directory and all files within.
Now click OK on the bottom.
Now you can edit and save in your c files and it will compile and create the .so file on the fly.
user669231
Updated on July 25, 2022Comments
-
user669231 almost 2 years
I have been working with Android SDK for a while & just came across an requirement to use the NDK
So, I downloaded the Android NDK for Windows. Jumping on the first example, when I am trying to build the library using the process defined in the NDK example
http://developer.android.com/sdk/ndk/overview.html
Specifically the command /ndk-build from the command line
I am getting the error
ndk-build is not recognized as an internal or external command, operable program or batch file
I have added the path for ndk-build in the PATH variable and even tried calling the command going to the folder, still the same error
Does anybody have a clue?
-
Hunt over 11 yearsI followed your approach but i am getting
Please install Cygwin make package or define the GNUMAKE variable to point to it.
do you have any idea to solve this -
JPM over 11 yearsAnd your positive that you installed cygwin first? Latest Eclipse version doesn't require you to install cygwin anymore.
-
Hunt over 11 yearsi solve that
GNUMAKE
error by re installing cygwin but if i set ndk-build without using cygwin in eclipse then i am getting error which saysit is not valid win 32 app
-
JPM over 11 yearsSounds like you are mixing 32 and 64 bit programs. You have to make sure all programs are the same bit size
-
JPM almost 11 yearsNo longer needed in the latest versions of eclipse NDK compiler included in Android tools
-
Nikos Yotis over 9 yearsdefinitely wrong. u don't need cygwin. windows prompt compiles just fine