Prashant Singh
Prashant Singh

Reputation: 3793

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 :)

Upvotes: 6

Views: 7589

Answers (3)

zohre
zohre

Reputation: 126

use:

$ android.bat update project --path .

Upvotes: 9

Yuliia Ashomok
Yuliia Ashomok

Reputation: 8598

C:\Users\Iuliia\AppData\Local\Android\android-sdk\tools\android.bat update project --path .

is the same as

android update project –p

if you haven't android in your PATH. Don't forget to give your path to Android SDK.

Upvotes: 0

axis
axis

Reputation: 872

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.

Upvotes: 1

Related Questions