I am trying to make ndk-build to work within Cygwin on windows. As per the NDK documentation (specifically INSTALL.htm), "The NDK requires GNU Make 3.81 or later being available on your development."
I have Gnu Make installed on my computer.
So far, so good.
Within Cygwin bash, I cd over to the android NDK root directory. Now when I type in the following command (without parameters right now, just to see if the command works):
$./ndk-build
ERROR: Cannot find 'make' program. Please install Cygwin make package or define the GNUMAKE variable to point to it.
So I try to set the GNUMAKE variable, but no luck:
$export GNUMAKE='/cygdrive/c\Program Files\GnuWin32\bin'
ERROR: Your GNUMAKE variable is defined to an invalid name: /cygdrive/c\Program Files\GnuWin32\bin
Please fix it to point to a valid make executable (e.g. usr/bin/make)
I even tried setting it to usr/bin/make as it suggests, but same invalid name error.
Anyone, knows how to resolve this?
I'm using Windows 7, NDK r5, Cygwin 1.7.1
I had an issue with GNUMake when putting the ndk in a folder with a space in it (I originally put it in the program files directory). I moved everything to C:/android/android-ndk and C:/android/android-sdk and updated my path settings to include these directories.
Its not problem with the make but installing cygwin
in ndk-demo script the make path is found using which command mostly which command
installation is missing in cygwin.
Solution:
Relaunch your cygwin installation select utils (install )
Checking:
$ which make
should give you the make command path on cygwin prompt.
Regards,
Vasu
This is a generic error. It means there was a problem somehow with the make command, but the error message itself is hidden. To help diagnose the problem, open your ndk_build script in the ndk directory, and change these lines:
ABS_GNUMAKE=`which $GNUMAKE 2> /dev/null`
...
GNUMAKE=`which make 2> /dev/null`
to these:
ABS_GNUMAKE=`which $GNUMAKE`
...
GNUMAKE=`which make`
And then you will get a more detailed error message. Note that it might not even be a problem with the 'make' command, it might be a problem with the 'which' command. Make sure you have cygwin installed.
delete Environmental variable GNUMAKE
close the cygwin terminal
open again cygwin terminal... go the path where u want to build.. and now build it...
I am sure hopefully you will build successfully..as i do..
The answer with moving NDK to a directory without spaces is definitely right. After that you will probably able to run ndk-build from the Cygwin shell.
However running ndk-build from Windows commmand line (like "bash ndk-build") will probably cause the same queer error with "incorrect GNU make".
It is reproducible with NDK 6b as well.
And I hope it is fixed in the newest version of NDK...
ERROR: Cannot find 'make' program. Please install Cygwin make package
or define the GNUMAKE variable to point to it.
While trying to install Cygwin i missed out to install MAKE PACKAGE
Just need to search make in the Search box and it will shows the Branches that includes devel branch and from devel branch i selected make package.
That's all issue fixed.
i worked hard on error in gygwin terminal "gnumake variable is define to invalid name" and after that i get to the point that we simply remove this error by deleting the GNUMAKE path in environment variable both in system and user variable if u created it hope its helps....
mycomputer > system properties > advanced system setting > environment variable
The problem here is the name of the GNUMAKE variable.The name given was
/cygdrive/c\Program Files\GnuWin32\bin change it into /cygdrive/c/Program Files/GnuWin32/bin/make
only use forword Slash .Sometime the space in the folder structure does not taken
Happy coding.
Related
I am follow this link to build their project, I have already prepared the environment(android sdk, android ndk, cygwin) on XP PC.
when I follow their steps, I didn't understand what they meant by this step
It may be helpful to explicitly identify the SDK's location in the shell variables SDK_BASE & NDK_BASE, & to call out which version of each you wish to build with. For instance, add something like this to ~/.bashrc:
export SDK_BASE=~/android/adt-bundle-linux-x86/sdk
export NDK_BASE=~/android/android-ndk-r8d
export SDK_PLATFORM_LEVEL=16
export NDK_PLATFORM_LEVEL=9s
So I skip this step!!
when I continued their steps I face problem when I need to make the C files by type this command
make -C external/
this caused error in try to build these files, and this appeared :
So how can I solve this problem ? and have successful build ?
It can't find your ndk installation! Those steps you skipped are important. For now, just type them into the command line before you build.
The problem with this is you'll lose these definitions when you close the terminal. The solution to this problem is to add those lines to your ~/.bashrc file:
Assuming it doesn't exist, you can create it on the command line with: touch ~/.bashrc
Then open this hidden file in your favourite text editor and add the export statements.
The error while building is
/ndk-build
Cannot run program "/ndk-build": Unknown reason
Error: Program "/ndk-build" is not found in PATH
PATH=[/usr/bin:/bin:/usr/sbin:/sbin]
I am trying to build a OpenCV project on Eclipse ADT and have done the following so far to build it.
Normal android projects(not involving c/c++ code) works fine.
1- I have edited the /etc/paths to the following
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
PATH=$PATH:/Users/mohitagrawal/adt-bundle-mac-x86_64-20130219/sdk/tools
PATH=$PATH:/Users/mohitagrawal/adt-bundle-mac-x86_64-20130219/sdk/platfor
m-tools
PATH=$PATH:/Users/mohitagrawal/android-ndk-r8e
2- I have edited $PATH to following(knowingly or unknowingly)
-bash: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
PATH=$PATH:/Users/mohitagrawal/adt-bundle-mac-x86_64-20130219/sdk/tools:PATH=$PATH:/Users/mohitagrawal/adt-bundle-mac-x86_64-20130219/sdk/platfor:m-tools:
PATH=$PATH:/Users/mohitagrawal/android-ndk-r8e:/opt/X11/bin:/usr/local/git/bin:/usr/texbin: No such file or directory
3- Build command in "C/C++ Build" in project properties is set to
${NDK_ROOT}/ndk-build
4- NDK location in Preferences of ADT eclipse is set to
/Users/mohitagrawal/android-ndk-r8e
Please help me. I am stuck from many days and has even tried on different platform.
You need to change the PATH in Eclipse since it is Eclipse that is trying to run the command. Go to Project Properties > C/C++ Build > Environment > PATH
Add the path to your ndk directory in the PATH variable (i.e. add /Users/mohitagrawal/android-ndk-r8e to the PATH variable).
Moreover, it apparently tries to run /ndk-build. Make sure that in Project Properties > C/C++ Build, "Build command" is ndk-build and not /ndk-build
EDIT: you can also try to build your project from the terminal, by navigating to your project and running the command ndk-build.
I've tried all the solutions that I could find on stackoverflow and none of them worked.
In the end I've found this blog.
I'll post the solution here as the link may break in the future:
1. Open up Terminal.
2. Run the following command: sudo nano /etc/paths
3. Enter your password, when prompted.
4. Go to the bottom of the file, and enter the path you wish to add.
5. Hit control-x to quit.
6. Enter "Y" to save the modified buffer.
I get this error when I do
$ ant release
sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
typing in android update project I get another error saying I must specify the path .... to the project.
Then I try cd into the directory of my project and do
android update -p .
android update -path .
etc and it says -p and -path are not globally recognized.
Could someone just give me the exact syntax?
cd to project directory and execute the following: The word project is part of the command, and is not to be replaced with an actual project name. The documentation does not make this clear and should be improved.
android update project -p .
You can use the command line argument for setting the sdk.dir, e.g:
ant -f xyz/build.xml clean release -Dsdk.dir=/Applications/adt-bundle-mac/sdk/
You can use sdk.dir in projet.properties file to define the sdk home or use an environment variable (more flexible for team work).
export ANDROID_HOME=<the path to your sdks>
You can inject the ANDROID_HOME environment variable into the sdk.dir property using the following ant command.
$ ant debug -Dsdk.dir=$ANDROID_HOME
ANDROID_HOME must be an absolute path such as /Users/jameswald/Development/android-sdk-macosx.
I had the same problem. After flailing around with the command line commands for a few minutes I ended up just editing the local.properties files directly.
You should have a file called local.properties within your
<app-directory>\platforms\android
folder. If you don't have one then you can create it.
Within the file there should be a reference that specifies where ant can find your android sdk. It should look like this:
sdk.dir=C:\\<path-to-sdk>\\sdk
Just update your details to point it to your correct android sdk folder.
The double \ are present in my file. Not sure why but it seems to work. :)
Note: this file also needs to be copied into your CordovaLib folder, which is one folder deeper: <app-directory>\platforms\android\CordovaLib
That should create/fix the local.properties from ant:
android update project --name --target
--path
name parameter is optional
target is the api version
More info here
https://developer.android.com/tools/projects/projects-cmdline.html#UpdatingAProject
android update project -p . might fix your issue. Sometimes once you execute android update project -p . You might end up with a O/P Like this.
Updated local.properties
----------
build.xml: Failed to find version-tag string. File must be updated.
In order to not erase potential customizations, the file will not be automatically regenerated.
If no changes have been made to the file, delete it manually and run the command again.
If you have made customizations to the build process, the file must be manually updated.
It is recommended to:
* Copy current file to a safe location.
* Delete original file.
* Run command again to generate a new file.
* Port customizations to the new file, by looking at the new rules file
located at <SDK>/tools/ant/build.xml
* Update file to contain
version-tag: custom
to prevent file from being rewritten automatically by the SDK tools.
----------
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
If so try this command android update project -p . -s
the ANDROID_HOME must be set in the right context - just that you have it e.g. on your bashrc does not mean the var is set when you launch by clicking the icon ( bashrc doesn not get executed then - but when checking if the env var is set on the console it is )
you can also put it in the studio.sh:
#!/bin/sh
#
# ---------------------------------------------------------------------
# Android Studio startup script.
# ---------------------------------------------------------------------
#
export ANDROID_HOME=/home/ligi/bin/android-sdk/
message()
{
I had the same problem and it turned out that one of the ant scripts for some reason is referencing hard coded path to C:\ant and as my ant was in C:\apache-ant-{version} it could not find it. After renaming the ant directory everything worked fine.
For reference the file where I observed this issue was
\apache-ant-{version}\bin\ant.bat :line 106
Edit: I am using windows 8
Yeah, none of these solutions worked for me. This did from here:
Setting ANDROID_HOME enviromental variable on Mac OS X
Open the terminal window and enter the following (I hope this is the complete path to sdk):
export ANDROID_HOME=/Applications/ADT/sdk
Once you have this set, you need to add this to the PATH environment variable
export PATH=$PATH:$ANDROID_HOME/bin
I'm new to development with the NDK of Android.
As I'm developing on Win7 I installed Cygwin in order to build the native binaries.
When running ndk-build from the project folder /home/simon/ndk/hello-neon I get the error
ERROR: You are using a non-Cygwin compatible Make program.
Currently using: C:/Programs/cygwin/bin/make
To solve the issue, follow these steps:
1. Ensure that the Cygwin 'make' package is installed.
NOTE: You will need GNU Make 3.81 or later!
2. Define the GNUMAKE environment variable to point to it, as in:
export GNUMAKE=/usr/bin/make
3. Call 'ndk-build' again.
The problem that stops me now is that the ndk-build script seems not to be able to call the check-cygwin-make.mk script in the following lines:
GNUMAKE=`cygpath -u $GNUMAKE`
PROGDIR_MIXED=`cygpath -m $PROGDIR`
CYGWIN_GNUMAKE=`$GNUMAKE -f "$PROGDIR_MIXED/build/core/check-cygwin-make.mk" 2>&1`
When calling
echo $CYGWIN_GNUMAKE
I get the reply:
make: C:/Programs/cygwin/home/simon/build/core/check-cygwin-make.mk: No such fil
e or directory make: AndroidManifest.xml build.properties default.properties jni
res src No rule to make target `C:/Programs/cygwin/home/simon/build/core/check-
cygwin-make.mk'. Stop.
Now I'm lost because I don't understand the role of the check-cygwin-make.mk script and I could not find it anywhere on my drive.
I'm aware of the problem with spaces in the C:/Program Files/ folder name, and I think this is not problem now.
I hope someone can help my to solve this issue,
Regards,
Simon
Install android-ndk and cygwin(with "make" support command) then set the varaibles like this
Right-click My Computer, and then click Properties.
Click the Advanced tab.
Click Environment variables.
then edit"PATH" add this line
C:\cygwin\bin like this
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files......;C:\cygwin\bin
then try with your built steps
'check-cygwin-make.mk' is in '\android-ndk-r6b\build\core', and you should have installed Android NDK to a directory without spaces in the path.
Next you should be running ndk-build either from Cygwin-shell, or with the command 'bash -c ndk-build'.
And of course the necessary paths both to Cygwin binaries (as in the previous answer), and to ndk-build should be specified in PATH.
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?
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.
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
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?
I also faced this problem. And i solved it and post entire answer here. I hope it helps you.
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.
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'
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.