Building Android Apps: Going Native - Setting Up the Environment

1/9/2011 4:53:42 PM
In order to work together, the Android SDK and PhoneGap need to be able to find each other. To facilitate this, you need to configure your PATH environment variable.

Your computer uses environment variables to store little bits of data that are used by programs that you run. One of these, PATH, is a list of directories that tells programs where to look for other programs. So, when you type the name of a command (such as grep or findstr) at the command prompt, your computer looks in each of the directories in your PATH for the command.

On Windows, items in the PATH are separated by a semicolon, as in: C:\Windows\System32;C:\Windows. On Mac and Linux, they are separated by a colon, as in /usr/bin:/usr/local/bin.

To add a directory to your PATH under Windows, open up your computer’s System Properties. You can get to this by left-clicking the Start Menu, right-clicking Computer (or My Computer), and selecting Properties. On Vista or Windows 7, click the Advanced System Settings link on the left. On Windows XP, click the Advanced tab.

In the dialog box that appears, click Environment Variables. Under System Variables, scroll down until you see PATH and double-click it. Be careful not to modify anything in there yet (if you make a mistake, you can always click Cancel and start over). Move the cursor all the way to the right, and add the following (with no space before the semicolon):


Replace C:\Android with the location of the Android SDK (such as C:\Users\yourusername\Desktop\Android) and replace C:\PhoneGap with the location where you put PhoneGap. Click OK and dismiss the remaining dialog boxes.

On Mac OS X or Linux, you should find a .bash_profile file in your home directory. It will be invisible, so try running this command at the command line:

ls -l ~/.bash_profile

If that file exists, edit it by running the nano editor as shown below. If it does not exist but you have a .profile file (use ls -l ~/.profile to find out), edit that file instead (just replace .bash_profile with .profile):

nano ~/.bash_profile

Next, scroll all the way to the bottom of the file using the arrow keys and add the following line:


Replace ~/Android with the location of the Android SDK (such as ~/Desktop/Android/tools) and replace ~/PhoneGap with the location of PhoneGap. Save the file by pressing Control-O then Enter. Press Control-X to exit.

Close any open Command Prompts or Terminals, then restart them. You should be able to run commands such as adb or android at the command line. If not, see and review the instructions there.


The utility in the PhoneGap/bin folder requires that Ruby be installed on your computer. It should be installed by default on any Mac or Linux system. If you install it on Windows (see, you may need to edit your PATH variable again and add the path to Ruby’s bin directory (such as C:\Ruby191\bin). Don’t forget to add a semicolon before the path entry as you did earlier.

Video tutorials
- How To Install Windows 8 On VMware Workstation 9

- How To Install Windows 8

- How To Install Windows Server 2012

- How To Disable Windows 8 Metro UI

- How To Change Account Picture In Windows 8

- How To Unlock Administrator Account in Windows 8

- How To Restart, Log Off And Shutdown Windows 8

- How To Login To Skype Using A Microsoft Account

- How To Enable Aero Glass Effect In Windows 8

- How To Disable Windows Update in Windows 8

- How To Disable Windows 8 Metro UI

- How To Add Widgets To Windows 8 Lock Screen
programming4us programming4us
Top 10
Free Mobile And Desktop Apps For Accessing Restricted Websites
TOYOTA CAMRY 2; 2.5 : Camry now more comely
KIA SORENTO 2.2CRDi : Fuel-sipping slugger
How To Setup, Password Protect & Encrypt Wireless Internet Connection
Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
Backup & Restore Game Progress From Any Game With SaveGameProgress
Generate A Facebook Timeline Cover Using A Free App
New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
Popular Tags
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Exchange Server Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe Photoshop CorelDRAW X5 CorelDraw 10 windows Phone 7 windows Phone 8 Iphone