I know there is lot's of this question already however half of the just redirect to other questions and the others either tell me to stuff i tried, none of which worked.
The problem is i have been following this Tutorial. And the last step tell's me to use the ndk-build command, however when i try to run it i get this
'ndk-build' is not recognized as an internal or external command,
operable program or batch file.
I know i have the environmental path thing set right, and i did install cygwin and i did add it manually to the android program. So i do not know what the issue is. Any help would be much appreciated!
I also tried adding my ndk path to the System environment variables but the error was still there.
It worked for me by:
Opening command prompt and navigating to project
c:\eclipse\workspace\myproject
I then executed the ndk-build script from the android ndk folder
c:\eclipse\workspace\myproject> c:\android-ndk-r10e\ndk-build
I solved this issue by setting my NDK_HOME environmental variable and updating my path.
The $NDK_HOME on OSX or Linux (or %NDK_HOME% on Windows) points to the Android NDK Home Directory.
Then updating the PATH variable to include that directory and appending /build to the end of the path which solved the issue.
Not sure about cygwin (it sometimes makes windows-user-friendly exceptions), but on a real linux there are at least 3 gotchas:
1) the current directory is not searched for executables (at least by default)
2) You have to set the execute permissions on the files you want to execute, chmod a+x filename sets that permission, ls -l filename shows the permissions.
3) The disk may be mounted so that execution is not allowed.
4) file names are case-sensitive
which exefilename shows the full path of a command -- that is, if the system recognizes exefilename as executable.
Does it work if you provide the full path?
Does it work is you use source /full/path/to/ndk-build ?
Related
My application code is written and executed with no errors. However my emulator will not show up nor does my android device that's plugged in (virtualization is turned on, SDK packages are downloaded, Hyper V is not installed). I get this message from the ADB console:
adb is not recognized as an internal or exteral command, operable program or batch file.
I have tried editing the %PATH% in both system and user variables but it never works.
I am using the latest Android studio and all the tutorials and answers to my problem refer to Eclipse. At this point I am wondering if I should just abandon Android studio and take refuge in the larger Eclipse community.
Can anyone advise me how to fix it? I've been already trying a long time and I would like to finally see my application in action.
Your PATH is incorrectly setup.
For Windows :
Open up Command Prompt
and type
setx ANDROID_ADB_PATH "pathtoyoursdkplatformtools" /m
example:
setx ANDROID_ADB_PATH "C:\android-sdk-win\platform-tools" /m
Identify the exact location of your SDK. From command prompt cd to that folder and execute adb from there. if it still fails, your installation is corrupted. Delete all previous installtions of Android Studio and install fresh. If it works from adb folder , then you are making a mistake in setting up the path correctly.
set PATH=%PATH%;C:\Program Files\android-sdk-windows\platform-tools
this will only work for that particular session though.With respect to HAXM, always make sure the memory you allocate for a AVD is less than 650MB and check the Use Host GPU checkbox.
You've to set the adb.exe path location here.
You can find that, file>other setting>default project structure>{get your sdk file location}
Ex: C:\Users\Spectrum_Developer\AppData\Local\Android\Sdk
Open this path in file explorer and get into platform-tools. You can see adb.exe here.
Set this current path which is for ex. C:\Users\Spectrum_Developer\AppData\Local\Android\Sdk\platform-tools in your system environmental path variable
Restart the system.
Happy coding :-)
I'm having precisely the same issue as this person:
android' is not recognized as an internal or external command
However, I have also set the PATH environment variable (Windows 7) as recommended in the answer to the above post. In particular, I have:
C:\Users\p\AppData\Local\Android\android-sdk\tools
and
C:\Users\p\AppData\Local\Android\android-sdk\platform-tools
In addition, I have set %ANT_HOME%\bin and %JAVA_HOME%\bin. I have checked that the android.bat is indeed in the tools directory pointed to, that the PATHEXT variable contains ".bat", and I have restarted the command prompt. And yet 'android' is not recognized.
Does anyone have an idea what might be the problem? Many thanks in advance!
Find android.bat on your system. On mine (win 8 x64) it's under C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat
Open a command console, and use the 'doskey' command:
doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
This will continue to work in the command console you executed the doskey command in. To make it permanent is more difficult: http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html
I do not know what causes the issue with the path variable.
However, the workaround I've used is to move to the "tools" directory and call android from there; I've added "--path " to point to the directory in which the project resides.
Details on how to manage android projects from the command line can be found here:
http://developer.android.com/tools/projects/projects-cmdline.html
You might have installed Cygwin as part of the SDK. I had the same problem "android.bat is not recognized as an internal or external command". So, Uninstall the Cygwin and try again (you might not able to uninstall Cygwin, since a mysterious “permission denied” when deleting the Cygwin files by default). You need to own access to this mysterious Cygwin files by taking ownership:
takeown /r /d y /f cygwin (do this, wherever is your cygwin folder is)
This command takes ownership recursive of the folder, without asking anything and gives Full Access to Everyone recursively in the folder:
icacls cygwin /t /grant Everyone:F
And finally, the command which deletes it all and removes Cygwin:
rmdir /s /q cygwin
Good bye Cygwin! ;-)
Now try again. (This worked for me)
PS: You can always re-install cygwin again. So, nothing wrong giving it a try. Good Luck
**Set the path in windows**
Control Panel\System and Security\System > advance system settings > environment variables
and update the path to include the following:enter code here
<android-root>\android-sdk-windows\tools
Use semicolons to separate paths in case yo have to add more path .
I need to edit run.sh file in eclipse in windows. I'm following instructions in here, and I've installed the Android app completely and it's OK on my Xperia, however when it comes to building the host client part in the fourth line I don't know what run.sh does neither I know how to edit it,by the way, I guess it's a Linux file. And I have to say that I haven't installed CyanogenMod software as it is not Xperia p compatible according to it's website. The code in run.sh file in se.pki.client package, which I downloaded and imported previously, is as following.Althoug I've changed the code in the second line(giving it the path where my jdk is stored) while there's still an error in the first line saying the word "sh" is not correctly spelled and another error in the third line to
#!/bin/sh
JAVA_HOME=C:\ProgramFiles\java\jdk1.7.0\
$JAVA_HOME/bin/java -Dsun.security.smartcardio.library=/usr/local/lib/libpcsclite.so -cp bin/ org.nick.sepkiclient.Main $*
.sh files are the linux equivalent to a batch file. From the code you posted it just runs the java command (giving it a bunch of command line inputs) you should be able to run the same command in the windows terminal by just replacing the paths to windows paths. If there is more to the script than the 3 lines, you're going to needed to try and convert each line to a valid windows command (depending on the complexity of the script, this may not be possible.)
Your other option is to install software like Cygwin which adds a POSIX compliment shell (along with many other linux-ish modifications). This should allow you to run .sh files 'natively' in windows (it will require some fiddling with the script to provide the correct paths). Be sure you read about cigwin before you install it, it changes quite a lot about your system that you might not be comfortable with.
Each option has its drawbacks, and both require a little knowledge of shell scripting. Might just be easier to run Linux for what your doing (it behaves itself reasonably well in a VM).
Make sure you have it set as a unix file.
Window> Preferences>General>Workspace
Select line delimiter Other then Unix and test file encoding as UTF-8
As a last resort run dos2unix on the file from the shell.
I am trying to familiarise myself with using adb from the command prompt.
My adb.exe is installed at:
C:\Program Files(x86)\Android\android-sdk\platform-tools
I have tried starting off by typing in cd:C\ to take me to the C drive
Then I have typed in the path quoted above, sometimes putting Program Files(x86) in quote marks,
other times inserting % in between Program and Files.
But always I get the same answer - "The system cannot find the path specified".
Even when I type the path and then put in “adb devices” I get nothing.
I have tried inserting each of the following in the path in system variables as follows:
;C:\"Program Files(x86)"\Android\android-sdk\platform-tools\
C:\"Program Files(x86)"\Android\android-sdk\platform-tools\
;C:\Program Files(x86)\Android\android-sdk\platform-tools
And then typing “adb devices”.
The message is the same – “adb is not recognised as an internal or external command, operable program or batch command.
You can call adb directly from the directory you are currently in: "C:\Program Files(x86)\Android\android-sdk\platform-tools\adb.exe" (With quotes!) You can also navigate to the platform-tools directory and then call adb.exe, use cd .. to go to a directory level up, you can hit TAB to let windows list the appropriate directories, this works also if one or more characters are entered.
Btw, just added "C:\Program Files\Android\android-sdk\platform-tools" to my PATH and it works just fine! Separate the entires with a semicolon.
for using a 64 bit os try going step by step,
type in command prompt
cd "C:\Program Files (x86)"
you will enter C:\Program Files (x86)directory
then type
cd Android\android-sdk\platform-tools
It's the spaces that are messing people up. Windows users need to remember one important thing when dealing with command lines: do not install the utilities to folders where there's a space in the folder name - it will save you a lot of hassle which sometimes can't even be solved by using quotes.
For example, I've installed the Android SDK to C:\Android\android-sdk-windows
To open a command prompt, I have a shortcut to ("target") C:\Windows\System32\cmd.exe
And the "Start in" path is C:\Android\android-sdk-windows\platform-tools
now all I do is double-click the shortcut and I can dive right in to ADB
I have to use NDK for a clien't project. I am using Windows 7.
I followed the installation instructions. I have installed Cygwin 1.7.1.
In Cygwin bash, I go into the android NDK root directory.
When I see the contents of the directory, usin $dir command, I can see all the contents including ndk-build, but when I try to use ndk-build, this is the result I get:
$ndk-build
bash: ndk-build: command not found.
Not sure what I am doing wrong.
Cygwin emulates a GNU/Linux environment on your Windows computer. This means you're working with a "Shell" which is not exactly the same as the Windows command-line.
If you type asdf.exe in your Windows command-line, it tries to find asdf.exe in the current directory. If it can find it, the file is executed. If it can't find it, it'll go through every directory of your %PATH% and try again.
However, if you type asdf in your bash (there are multiple kind of shells, the Bourne Again SHell is one of them), it will not look after it in the current directory. Instead it'll try to find it in one of your PATH directories. Can't give you any sources here, but AFAIK it's for security reasons. If you want to run a file which is not in your PATH, you must prepend it with its absolute of relative path. You can use ./, it points to the current directory.
That's why you need to type ./ndk-build, because it's in the current directory and not your path. Something like /path/to/ndk/ndk-build will also work, but you have to type a bit more :).
(In fact it's even more complicated, if you want to execute a file, you need execute permissions for it. Google will help you if you have any problems with that.)