1 -
下载 http://dl.google.com/android/android-sdk_r07-windows.zip
一个大约22MB左右的SDK Setup工具,运行setup.exe,
双击后就可以看到Android SDK and AVD Manager界面,在Installed Packages
这样软件会自动刷新Refresh Sources下载源,不知道为什么提示Faild to fetch URL,
不过我们手动连接正常,可能Google的这个Eclipse插件处理SSL加密URL存在bug。
2 -
根据提示,我们选择Settings,勾选Force https:// sources to be fetched using http://
这项,然后选择Save & Apply这项,
3 -
接下来我们再次回到Installed Package中,单击Update All按钮后会显示
Choose Packages to Install对话框,我们选择目前最新的SDK Platform android 2.0.1 这项,
然后选择Accept同意许可,最后单击Install Accepted按钮
下载SDK
https://dl-ssl.google.com/android/repository/repository.xml
(网速慢的可以直接复制下列地址,用迅雷下,目前测试有效
所有平台公共文件
https://dl-ssl.google.com/android/repository/google_apis-3-r03.zip
https://dl-ssl.google.com/android/repository/google_apis-5_r01.zip
https://dl-ssl.google.com/android/repository/google_apis-6_r01.zip
https://dl-ssl.google.com/android/repository/google_apis-4_r02.zip
https://dl-ssl.google.com/android/repository/google_apis-7_r01.zip
https://dl-ssl.google.com/android/repository/google_apis-8_r02.zip
https://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.zip
https://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip
https://dl-ssl.google.com/android/repository/docs-2.2_r01-linux.zip
https://dl-ssl.google.com/android/repository/market_licensing-r01.zip
windows平台
https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip
https://dl-ssl.google.com/android/repository/android-1.1_r1-windows.zip
https://dl-ssl.google.com/android/repository/android-2.0_r01-windows.zip
https://dl-ssl.google.com/android/repository/android-2.0.1_r01-windows.zip
https://dl-ssl.google.com/android/repository/android-1.5_r04-windows.zip
https://dl-ssl.google.com/android/repository/android-1.6_r03-windows.zip
https://dl-ssl.google.com/android/repository/android-2.1_r02-windows.zip
https://dl-ssl.google.com/android/repository/android-2.2_r02-windows.zip
https://dl-ssl.google.com/android/repository/tools_r07-windows.zip
linux平台
https://dl-ssl.google.com/android/repository/android-1.1_r1-linux.zip
https://dl-ssl.google.com/android/repository/android-2.0_r01-linux.zip
https://dl-ssl.google.com/android/repository/android-2.0.1_r01-linux.zip
https://dl-ssl.google.com/android/repository/android-1.5_r04-linux.zip
https://dl-ssl.google.com/android/repository/android-1.6_r03-linux.zip
https://dl-ssl.google.com/android/repository/android-2.1_r02-linux.zip
https://dl-ssl.google.com/android/repository/android-2.2_r02-linux.zip
https://dl-ssl.google.com/android/repository/tools_r07-linux.zip
)
4 -
在eclipse里通过https://dl-ssl.google.com/android/eclipse/
(注意:如果有问题,可以把 https 换成 http 试一下。点击 OK.)
安装ADT
[配置 ADT]
配置 Eclipse 里的 ADT,使其指向 Android SDK 。
1. 选取 Eclipse Window > Preferences...
2. 选择 Android
3. 点击 Browse... 定位 Android SDK 目录。
4. 点击 Apply, 然后 OK.
(本节内容参考:http://androidappdocs.appspot.com/sdk/eclipse-adt.html)
[创建虚拟设备]
开发环境建立好了,就可以写一个“Hello World”应用。但在之前,还需创建一个虚拟设备。
运行 Eclipse, 选取 Window > Android SDK and AVD Manager.
在左侧面板选择 Virtual Devices
点击 New.
出现 Create New AVD 对话框
输入 AVD 名字, 例如 "my_avd".
选取一个目标。目标是一个平台 (即,Android SDK 的版本,如 2.2)
暂时忽略其他设置
点击 Create AVD.
[Hello World]
1). 创建一个新的 Android project
在创建 AVD 之后, 下个步骤就是在 Eclipse 里开始一个新的 Android 项目。
运行 Eclipse, 选取 File > New > Project.
如果 ADT 插件正确安装了,应该在 "Android Project" 里面有一项:"Android" 。(在你创建了一个或多个Android 项目后,一个 "Android XML File" 入口也应该可见。)
选择 "Android Project" 并点击 Next.
填写项目信息如下:
Project name: HelloAndroid
Application name: Hello, Android
Package name: com.example.helloandroid (or your own private namespace)
Create Activity: HelloAndroid
点击 Finish.
2). 编写代码:打印 Hello Android
package com.android.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
3)运行
ADT 使运行非常简单:
选取 Run > Run.
选取 "Android Application".
(Hello World, 参见:http://androidappdocs.appspot.com/resources/tutorials/hello-world.html )
附:Android SDK release number:
Android SDK 2.2 Revision 1 (May 2010) API Level: 8 Requires SDK Tools r6 or higher. FroYo
Android SDK 2.1 Revision 2 (May 2010) API Level: 7 Requires SDK Tools r6 or higher. Eclair
Android SDK 2.1 Revision 1 (Jan 2010) API Level: 7 Requires SDK Tools r6 or higher. Eclair
Android SDK 2.0.1 API Level: 6 Requires SDK Tools r6 or higher. Eclair
Android SDK 2.0 API Level: 5 Requires SDK Tools r6 or higher. Eclair
Android SDK 1.6 Revision 3 (May 2010) API Level: 4 Requires SDK Tools r6 or higher. Donut
Android SDK 1.6 Revision 2 (Dec 2009) API Level: 4 Requires SDK Tools r6 or higher. Donut
Android SDK 1.6 Revision 1 (Sep 2009) API Level: 4 Requires SDK Tools r6 or higher. Donut
Android SDK 1.5 Revision 3 (Jul 2009) API Level: 3 Requires SDK Tools r6 or higher. Cupcake
Android SDK 1.5 Revision 2 (May 2009) API Level: 3 Requires SDK Tools r6 or higher. Cupcake
Android SDK 1.5 Revision 1 (Api 2009) API Level: 3 Requires SDK Tools r6 or higher. Cupcake
Android SDK 1.1 API Level: 2
Android SDK 1.0 API Level: 1