网上的那个版本是针对Eclipse 3.4,在 Eclipse 3.5里面不太一样,大部分但配置方法载自linuxtoy
1. 下载 Android SDK
前往从以下网站获取 Android Linux 平台的 SDK 套件,这个都一样,当然这个网址已经被墙了,所有各尽所能爬出去吧
http://developer.android.com/sdk/
2. 解压缩并配置相关环境变量
将获得的 zip 解压到所喜好的位置即可,无须安装。
接下来需要将 SDK 目录中的 tools 添加到 PATH 路径中,方便调用。编辑 $HOME/.bash_profile 文件,在 PATH 一行末尾添加 SDK 中 tools 文件路径即可,用冒号分割。
如:
export PATH=${PATH}:<your_sdk_dir> /tools
使环境变量即时生效的命令
source .bash_profile
推荐为其 Android SDK 目录创建一个不包括版本号的符号链接,这样日后 SDK 升级时就无须调整 PATH 路径了。
3. 安装 Eclipse 集成开发环境
Android 推荐的 IDE 为 Eclipse,使用下面的命令安装它:
.su -c 'yum install eclipse-jdt java-1.6.0-openjdk-devel'
即可获得 Fedora Eclipse 3.5.1 版本。
4.配置 Android Development Tools
google官方给出了配置方法在 http://developer.android.com/sdk/eclipse-adt.html
我配置的时候出现错误:
Cannot complete the install because one or more required items could not be found.
Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found
解决方法如下:
For some reason ubuntu doesn't include the standard update repository for Eclipse by default. To fix this:
- Go to "Help/Install New Software..."
- Add http://download.eclipse.org/releases/galileo/ to the update sites list (strange it's not installed by default on ubuntu)
- From there, install WST (use the filter box to find the package)
- Restart eclipse
然后按照官方的方法配置
- Start Eclipse, then select Help > Install New Software .
- In the Available Software dialog, click Add... .
- In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field.
In the "Location" field, enter this URL:
https
:
//dl-ssl.google.com/android/eclipse/
-
Click OK .
- Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next .
- In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish .
- Restart Eclipse.
现在只是配置好开发环境,android各个版本但sdk还没有下载
android list targets
发现没有可用的设备
输入 android 打开图形配置界面
- Select Available Components in the left panel. This will reveal all components currently available for download.
- Select the components you'd like to install and click Install Selected .
- Verify and accept the components you want and click Install Accepted . The components will now be installed into your existing Android SDK directories.
If your computer can't get a list of targets via the default "https" URL, then go to the Settings tab in the "Android SDK and AVD Manager" and click on "Force https://... sources to be fetched using http://..."
现在发现有设备了,按照官方的方法
http://androidappdocs.appspot.com/guide/tutorials/hello-world.html
android create avd -- target 2 -- name my_avd
其中target后面的数字就是“ android list targets ”查到的设备id,最后的名字自己取,我命名为avd_版本号
直接回车,采用默认设置
然后打开Eclipse,在window--Preference--Android中把SDK的目录加入进来
ok,可以开始新建项目了