Configuring the PATH Statement

The first step is to configure your PATH statement. The path is the list of directories within which the operating system will look when trying to find a command that is being run. To see what your path is currently configured to, run the following from a terminal:

echo $PATH

You will get back something that resembles the PATH statement in the following illustration.

Use the export command to add Android to the PATH statement (see the next illustration):

export PATH=$PATH:<android path>

export PATH=$PATH:<android path>

Editing the PATH statement like this in Linux will change the PATH statement only for the current terminal session. To make your PATH statement change permanent, you must edit .bash_profile. Use vi to edit .bash_profile, as shown in the following illustration.

With .bash_profile open in the vi editor, it should look something like the next illustration. As you can see the PATH statement is clearly visible. Use the command

:i to put vi in insert mode, and then add Android to the PATH statement. Then press the ESC key, use the command :w to write the file, and then use :q to quit.

[email protected]


1 file Edit View Terminal Tabs Help

# .bash profile

# Get the aliases and functions if [ ■f -/.bashrc |; then -/. bashrc fi

# User specific environment and startup programs

PATH=$PATH:SHOME/bi n:$HOME/Android/tools

expo - PATH

".bashprofile" 12L, 196C

10, 1


The Linux version of the Android SDK comes with a Python script,, that is used to create your initial projects. When running the Python script, an output directory is created for your project. However, I like to create this directory manually to make sure it is created where I need it to be. Use mkdir to create a directory for your project (see the following illustration).

[email protected]

1 file Edit View Terminal Tabs Help

[email protected] ~]$ mkdir ardroidHelloWorld


[jfdimarzio(arew-host-2 -]$ |

After you create the project directory, you can run the Python script. The syntax for the script is very close to that of the Windows .bat file: --out <output directory> package.activityName

Use the script to set up your project. Take a look at the following illustration to see the output from the script.

[email protected]:~

i,. ULsjS

| File Edit View Terminal Tabs


[jfdimarzio(anew-ho5t-2 ~]$ Is

Android Desktop Download Music Public Videos androidHelloWorld Documents eclipse Pictures Templates workspace

[jfdimarziotanew-host-2 -]$ sudo --out androidHelloWorld andro id.prog package: out dir: androidHelloWorld activity name: HelloWorldLinux.

Created directory androidHelloWorld/src/android/programmers/guide

Added file androidHelloWorld/src/android/programmers/guide/

Created directory androidHelloWorid/bin

Created directory androidHelloWorld/res/values

Added file androidHelloWorid/res/values/strings, xml

Created directory androidHelloWorld/res/layout

Added file androidHelloWorid/res/layout/main.xml

Added file androidHelloWorid/AndroidManifest.xml

Added file androidHelloWorid/build.xml

Ejfdimarzio(anew-host-2 |

0 0

Post a comment