Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANDROID NDK - android: command not found

I was trying to go through the first sample exercise provided in Android NDK. I was trying to run the following command on cygwin

android update project –p

However, I am getting android: command not found error.

I checked my PATH variables. It already had ANDROID_HOME , ANDROID_HOME/platforms, ANDROID_HOME/tools, ANDROID_HOME/platform-tools

One thing that I noticed was that there is no application named android in any of the folder. There is just an executable JAR file named android. Is that OK , or , this is my mistake ?

My PATH value added on request

bin:/cygdrive/c/Program Files/Java/jdk1.7.0_03/bin:/cygdrive/c/Program Files/Java/jdk1.7.0_03/include:/cygdrive/c/Ant2/bin:/cygdrive/c/Android/android-sdk/tools:/cygdrive/c/Android/android-sdk/platform-tools:/cygdrive/c/android-ndk/android-ndk-r8b:/cygdrive/c/Program Files/Java/jdk1.7.0_03/lib:/cygdrive/c/Android/android-sdk/platforms:/cygdrive/c/Program Files/Java/jdk1.7.0_03/bin:/usr/lib/lapack

Can anyone predict what am I missing ?

Thanks :)

like image 666
Prashant Singh Avatar asked Oct 05 '12 15:10

Prashant Singh


People also ask

Where can I find Android NDK?

Open your Android Studio Preference (or "File->Settings") > Appearance & Behavior > System Settings > Android SDK. You can find the path to your SDK and NDK, which is in the same directory.

How do I know if Android NDK is installed?

You'll need to point to your NDK in your eclipse by adding the path of ndk-build to Window > preferences > android > NDK. Right click on your project folder. Choose android tools -> add native support (the bottom one) and click finish. Now it will ask for a name for your .

Where is NDK installed?

Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory. Each version is located in a subdirectory with the version number as its name.


2 Answers

use:

$ android.bat update project --path .
like image 91
zohre Avatar answered Oct 17 '22 12:10

zohre


There are errors in your approach:

  • you don't need Cygwin and you should not use it with the latest NDK or SDK ( and probably never, in any case ) because they are distributed for Windows, they are supposed to work in a Windows environment and not under Cygwin; this is an approach used for really old versions of the Android NDK ( Cygwin ) but not for the latest.
  • the Android SDK requires the JDK 6 not 7

Supposing that you will fix this errors, the part that you are still missing is:

  • right after the download of the official SDK you have to run the manager at least once, download the platform-tools and at least 1 platform, the android executable is usually included in the tools directory in the root of your SDK directory
  • you android command is incorrect and will not work even with android installed correctly, this is a correct version among all the ones that are possible android update project –p . -t android-10
  • Android has nothing to do with jar files in strict terms, jar files are container used by developers to add functionalities, you can see them as libraries, but Android does not care about jar files and apk files are only required to contain .dex files, files for the Dalvik VM

This android ... command is used to update the building setup to a particular path and target, after that you should have at least the minimum configuration to produce an apk if the source code is well written and organized.

If the application is only written in Java you only need to build the apk at this point, you can do this with an IDE like Eclipse or with ant doing only ant debug or ant release from the root of your project.

If everything will be fine you will find the apk in your <project root>/bin folder.

like image 26
axis Avatar answered Oct 17 '22 12:10

axis