设置环境变量

The first step in setting up your environment for developing Android applications is downloading the Android SDK starter package. The starter package is not a full development environment — it includes only the core SDK Tools, which you can use to download the rest of the SDK components.

You can get the latest version of the SDK starter package from the SDK download page. Make sure to download the package that is appropriate for your development computer.

After downloading, unpack the Android SDK archive to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-sdk-<machine-platform>. Make a note of the name and location of the unpacked SDK directory on your system — you will need to refer to the SDK directory later, when setting up the ADT plugin or when using the SDK tools.

Optionally, you may want to add the location of the SDK's primary tools directory to your system PATH. The primary tools/ directory is located at the root of the SDK folder. Adding tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory.

  • On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to the tools/ directory to it. If you don't see a line setting the path, you can add one:
      export PATH=${PATH}:<your_sdk_dir>/tools
  • On a Mac OS X, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile if you haven't already set one up on your machine.
  • On Windows, right-click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path (under System Variables). Add the full path to thetools/ directory to the path.

If you will be using the Eclipse IDE as your development environment, the next section describes how to install the Android Development Tools (ADT) plugin and set up Eclipse. If you choose not to use Eclipse, you can develop Android applications in an IDE of your choice and then compile, debug and deploy using the tools included in the SDK (skip to Adding Platforms and Other Components).

你可能感兴趣的:(eclipse,linux,android,bash,UP)