2:09 PM
0

To work, this cordova command needs to use some programs located into your sdk/tools directory. You need also have installed apache ant.
Then you must add these directories into your PATH system variable:
Background:
  • let's assume you have installed your Android SDK to the c:\sdk\android directory
  • you have installed you Apache ant to the c:\tools\apache-ant directory
Then you must create two system variables:
  1. ANDROID_HOME with the c:\sdk\android value
  2. ANT_HOME with the c:\tools\apache-ant value
Finally, you must modify the PATH variable and add those two to the end of the PATH' value:
;%PATH%\tools;%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
NOTE: for those who uses Linux, the instruction differs a bit.
More documentation available here.

For those chosen ones, who preferred Linux development environment

Requirements

First of all, you will need a few things to get started. They are: Android SDK and Apache Ant. Of course, you will need Java SDK (JDK) installed.
To get Android SDK working for all users, you shall need to modify the /etc/environment file and then restart your PC. But if you do not want that hard way - follow me, think of yourself as the only PC user. And use /home/YOUR_USERNAME/.bashrc file to edit.
Let's remember your home path one time to prevent further long lines. Add this one to your /home/YOUR_USERNAME/.bashrc:
export HOME="/home/YOUR_USERNAME"
We'll then use the $HOME notation when we want to say "/home/YOUR_USERNAME directory".

Setting up Android SDK

Download the Android SDK archive and unzip it somewhere. Let's say, yo your home directory, $HOME/adt-bundle/.
Add these lines to your $HOME/.bashrc:
export ANDROID_HOME="$HOME/android-bundle/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/android-bundle/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"

Setting up Ant

Just as with the Android SDK, download an archive and unzip it to your home directory. Then add these to your .bashrc:
export ANT_HOME="$HOME/ant"
export PATH="$PATH:$ANT_HOME/bin"
I've installed one via the apt-get so this did not affect my .bashrc.

Applying changes

To make these changes work, you should either work in a new terminal window (opened after the changes), or run source ~/.bashrc to make changes available in the current terminal window.

Wrapping up

At the end, you will got:
  1. Two directories at your home directory - ant and android-bundle
  2. A few lines, added to your .bashrc:
    export ANDROID_HOME="$HOME/android-bundle/sdk/tools"
    export ANDROID_PLATFORM_TOOLS="$HOME/android-bundle/sdk/platform-tools"
    export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
    
    export ANT_HOME="$HOME/ant"
    export PATH="$PATH:$ANT_HOME/bin"

0 comments:

Post a Comment