project_create.sh: line 4: android: command not found (cygwin&android&jni) - android

http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Windows.pdf
This is the tutorial I am following and I stucked in the JNI to opencv library
according to the steps I had run project_create.sh in cugwin and come up with the result project_create.sh: line 4: android: command not found
Then I created a project_create.bat file with line android update project --name android-opencv --path .\ copy project.properties default.properties
BUT it also come up with android is not recognized as an internal or external command/ operable program or batch file.
Both .sh and .bat didn't work and I couldn't move on. Because ant step depend on it
Could someone give me any idea how to fix it??
Thank you!

Android is an executable located in <path-to-your-SDK>/tools/. Unless your working directory is tools, or you have added it to your PATH, you will get this error.
To fix it, either edit the script to use the full path, or copy paste the files into the tools directory and run them.

Okay finally I made it!
First of all, modified project_create.sh put the path to android like C:/cygwin/home/Joyce/SDK/tools/android update project --name android-opencv --target 2 \ --path
And better add up the target too because you don't have to deal with the "target not found" problem.
Second of all, don't run it in cygwin terminal, run "sh ./project_create.sh" in windows terminal.
Thirdly, make sure ant\bin had been added up to PATH, then can run "ant debug" in windows terminal.
Finally, got "BUILD SUCCESSFUL"! JNI to opencv library done!

Related

Building wpa_supplicant with 'mm' command

I am new to Android. I have the entire source code of Android for the imx platform. I would like to build the wpa_supplicant folder present under external folder. Everytime I make a change, instead of building the entire source, I would like to build only the wpa_supplicant folder. I have read that using the 'mm' command I can do it. However, i am not sure where to find the 'mm' command. For when I type #mm external/wpa_supplicant_8, I get the following error message displayed:
The program 'mm' can be found in the following packages:
* mountmanager
* multimail
Try: apt-get install
I am not sure if I need to do an apt-get install or the binary is present somewhere I else. Can someone help me with this? Also, how do I compile only a single application present in external folder? Please help.
Run the build/envsetup.sh script from your root folder:
path/to/android# . ./build/envsetup.sh
Then lunch for your device, and you'll be able to mm as necessary.
Go to Android directory and run $:source ./build/envsetup.sh
'android$:lunch` and select the configuration which you are building.
Now go to the directory where project located and execute mm or 'mma' (to build the dependencies also)

Android NDK in ADT and Mac OS (10.8): Cannot run program "/ndk-build": Unknown reason Error: Program "/ndk-build" is not found in PATH

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.

Ant Build Android Project With Dependencies

I'm trying to build an app (let's call it android-app) with a dependency on an SDK (let's call it sdk) via Ant. Eclipse is not installed on this computer (for reasoning, it's a CI box with Jenkins).
Both projects are in two completely separate directories side by side. android-app is in the directory ~/.jenkins/jobs/android-app/workspace and sdk is in the directory ~/.jenkins/jobs/sdk/workspace.
Let's assume both projects are "vanilla" and have not been built with Ant before. I cd to the ../android-app/workspace directory and run android update project -p . --library ~/.jenkins/jobs/sdk/workspace which passes. I then cd to the ../sdk/workspace directory and run android update project -p . which also passes.
At this point I cd back to the ../android-app/workspace directory and run ant clean build. It fails with the error:
BUILD FAILED
/path/to/ant/build.xml:440:
/path/to/sdk/workspace resolve to a path with no project.properties file for
project /path/to/android-app/workspace
... where /path/to is the full path to the directories. I simplified it here.
If I cd to the sdk workspace and open project.properties, I receive the following:
# ProGuard
proguard.config=proguard.cfg
# Project target.
target=android-10
android.library=true
It does exist. So do all of these files:
So, why is this failing? What am I doing wrong? I tried to provide as many details as possible. Please let me know if I can provide anything additional.
Well, I encounter this problem too.
I use strace to find out what the hell is going on and found that the path you specified in project.properties will be appended with your current folder path as its prefix.
For example,
/home/myfolder/project > ant debug
And the library you specified in project.properties is /path/to/library
Then, the path will become
/home/myfolder/project/path/to/library
Just to fill in the answer gap here, my Java version was completely off. I'm super embarrassed.

Android NDK: ndk-build script fails - script "check-cygwin-make.mk" not found

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.

NDK build error

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.

Categories

Resources