Cannot run program "sh": Launching failed - android

I downloaded cygwin and install. Then copy the ndk file to android folder. The path is C:\Program Files\Android\android-ndk-r9b then add this path to systemVaraible. Then choosen ndk location in Eclipse preference. Then right click the project, select AndroidToold->Add Native supportI'm getting this error: Build of configuration Default for project ImageTargets
(Cannot run program "sh": Launching failed)
Then open the cygwin terminal type $ cd /cygdrive/c/Program Files/Android/androi-ndk-r9b/samples/san-angles ndk-build
Below error i'm getting. Where i made mistake?
-bash: cd: /cygdrive/c/Program: No such file or directory

I had the same error on Windows and it was resolved by setting the correct path for Android NDK in the Eclipse workpace (Preferences->Android->NDK).

You don't need cygwin to work with NDK r9b on Windows. But whether you have cygwin installed or not, you should avoid spaces in the file names for your Android NDK or SDK installations. The easy fix would be to specify the path using short name, e.g. C:\Progra~1\Android\android-ndk-r9b.
See more at The Android emulator is not starting, showing "invalid command-line parameter", or Using Proguard for Android in Eclipse got Error.

the "Cannot run program "sh": Launching failed" may come from a bad eclipse configuration.
You can try to reset C/C++ Build configuration, inside your project settings:
Also on Windows, like Alex Cohn said, you don't need cygwin and can directly launch "ndk-build.cmd" script that is inside your NDK installation folder.

Related

Building android app with command prompt

i am trying to build my first training application for android using only sdk tools. I am using this tutorial: https://developer.android.com/training/basics/firstapp/running-app.html
I am in my project folder which was generated with android create project command.I am using windows 8.1 64 bits.
Unfortunately when i am trying to run gradlew.bat assembleDebug i an got error:
'gradlew.bat' is not recognized as an internal command or external command,operable program or batch file.
I don't know what is going on. I add platform-tools and tools to my path. I would be grateful for help!
When i am using gradle -v i am getting information about gradle. Byt gradlew.bat is not working.
Find the directory where gradlew.bat present and add it your the Environment path.
I found gradlew in he below path and it works!!!!
C:\Program Files
(x86)\Android\android-sdk\tools\templates\gradle\wrapper\
Just do this, this solved my problem before.
Open Control Panel
Go to System → Environment Variables
In PATH add the following entry at the beginning: %SystemRoot%\system32;

Android Eclipse cannot find program "sh " in PATH

I'm trying to run program using android ndk. Eclipse shows problem "Program "sh" not found in PATH C/C++ Problem". I've already made a reference to ndk folder in path. What is "sh"?
I had the same error on Windows. Setting the correct path for Android NDK in the Eclipse Preferences->Android->NDK fixed it.
In my case, the project works fine after removing the project from the workspace and import again. I don't know why:(
I had this problem with NDK, probably you have spaces defining the path of your sdk.
Check if you have specified the NDK path as
C:\Program Files\Android\android-ndk
avoid the "spaces", so change to:
C:\Progra~1\Android\android-ndk
Read : The Android emulator is not starting, showing "invalid command-line parameter" (applies for SDK & NDK)

The command 'android' failed

I've read this: Cordova and setting Android using command line
and that How to add android to cordova platform? PATH error? and generally speaking whole documentation. I've added both 'platform-tool' and 'tool' paths, installed android 4.4 and I'm still getting the error from the tittle when I'm trying cordova platform add android to my current project ( in cmd and in netbeans ).
The only thing I haven't done is adding java and ant to path. I was trying with ;%JAVA_HOME%\bin;%ANT_HOME%\bin but still those commands aren't recognizable.
What else can I do?
EDIT:
I've added java and ant to PATH. This is what I get in cmd:
C:\xampp\htdocs\mobile_maps>cordova platform add android
[Error: The command `android` failed. Make sure you have the latest Android SDK
installed, and the `android` command (inside the tools/ folder) added to your pa
th. Output: ]
Second EDIT:
i also get 'xcopy' is not recognized as an internal or external command even though I've added %SystemRoot%\System32; %SystemRoot%; %SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0 . I really don't know what else I can do..
usually this happens when:
1. Java is not installed
2. Java is not exported (no JAVA_HOME env variable) or paths are wrong
3. only 64bit version of Java is installed
to fix install 32bit support on your system.
and (as comments below) relog in Windows to environment changes take effect.

An error occurred during creation of android sub-project because a path is not found

I'm trying to do phonegap build android and I have this message :
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. Path not found
Phonegap is looking for "C:\Documents and Settings\corbg\.cordova\lib\android\cordova\3.0.0\bin\create". There is nothing under the directory "3.0.0". I installed cordova like this npm install -g cordova.
I have the some problem when I run cordova platform add android.
Did I missing something?
In Windows machine you have to delete .cordova directory under
C:\Users\user_name\
I have face the same issue, then i corrected my application path, afterthat it is worked out for me.
If you are using win 7 then add the Android ADK path in
open the mycomputer -> Properties -> Change Settings-> Advanced -> Environment Variable -> User variable for ....-> path
add the Android ADK path here like as following
C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\tools; C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\platform-tools
also add JAVA_HOME and ANT_HOME.
- Abdul Jabbar
Did you set your PATH variable? Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to test if they are correctly set, you can simply execute both (from any folder in your command line):
> java
or
> ant
and both programs should be found.
It was a problem with my proxy. Cordova create a .cordova directory and try to download something on the internet. The download did not work. Next time, it check if there is a .cordova directory. It don't try to redownload something because the directory exist and it show the error.
I removed the .cordova directory and I solved my problems with proxy. Now, everythings works.
What solved the issue for me was having 2 directories on my PATH, the android platform-tools and tools.
In my pc those folders were at
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
Also make sure you have the following environment variables
JAVA_HOME (C:\Program Files\Java\jdk1.7.0_51)
ANT_HOME (C:\Program Files\apache\apache-ant-1.9.3)
ANDROID_HOME (C:\Program Files (x86)\Android\android-sdk\platform-tools)
I removed the .cordova folder under my user folder but I'm not quite sure if that helped as well.
These links may help you
An error occured during creation of android sub-project
android' is not recognized as an internal or external command
I had the exact same problem for a different reason. I had an old version of ant (1.7.1). At least version 1.8.2 is needed for the build to work.
its either due to improper installation or no installation of ANT or JAVA. But moreover we need to add Android SDk and prepare Android Targets via SDK manager before going through this.
This is because you haven't installed ANT!
download it from here and install it step by step
https://ant.apache.org/manual/install.html
Then running the last command it will install the dependencies needed.

Building OpenCV 2.4.5 in android ADT: "ndk-build" not found in PATH

I'm trying to follow this OpenCV document to import OpenCV sample projects into the android ADT, and am getting the now infamous "Program "C:\android\android-ndk-r8d-windows\ndk-build" not found in PATH" error. My OS is Windows 7 and I use cygwin for any Linux-like commands.
Please note: I already downloaded the NDK package, and already set the value of NDKROOT to be my NDK root folder. I setup NDKROOT both as a system-wide environmental variable, and as an ADT's C/C++ Build environment variable, as shown below:
In my NDK root folder, I made identical copies of the file "ndk-build.cmd", and renamed them as "ndk-build" and "ndk-build.sh" respectively. I chmod+x to all three ndk-build* files.
Now what happens is really puzzling: If I specify the C/C++ Build command to be ${NDKROOT}/ndk-build or ${NDKROOT}/ndk-build.sh, I get the error "Program "C:\android\android-ndk-r8d-windows\ndk-build" not found in PATH". However, if I specify it to be ${NDKROOT}/ndk-build.cmd, ADT apparently finds it, but tries to run it as a Windows command, not as a bash script, as shown below:
The only way I can build a project, is to open a cygwin terminal, cd to the sample project folder, and run the script (either ndk-build or ndk-build.sh), like this:
I googled around for a solution. Although there are lots of "ndk-build.cmd not found in PATH" questions, I have not seen a case like mine. What is happening? I might also post my question to the openCV forum.
Apparently, the command that your Eclipse tries to run (when using the ${NDKROOT}/ndk-build.cmd version) is C:\\android\\android-ndk-r8d-windows\\ndk-build.cmd, which is apparently correct.
The problem is that your ndk-build.cmd is not a windows command file. And it should be. I just downloaded the Windows version of the ndk-r8e and the ndk-build.cmd file is copied here.
Try to download the ndk again or to modify your cmd file.
you should add the ${NDKROOT} variable (which is the folder in which the NDK is located) the same way you did with the PATH variable

Categories

Resources