ubuntu9.04上android sdk 1.5 安装与配置

1.下载android sdk
下载地址如下:
http://dl.google.com/android/android-sdk-windows-1.5_r2.zip
http://dl.google.com/android/android-sdk-linux_x86-1.5_r2.zip
2.下载eclipse 3.4.2
按官方文档说,android sdk 可以运行在eclipse 3.3以上的IDE中,ubuntu源中的eclipse版本过低,建议使用eclipse 3.4.2,其下载地址为:
http://download.actuatechina.com/eclipse/eclipse/downloads/drops/R-3.4.2-200902111700/eclipse-SDK-3.4.2-linux-gtk.tar.gz
3.安装eclipse 3.4.2
先将eclipse解压:
$tar xzvf eclipse-SDK-3.4.2-linux-gtk.tar.gz
将解压出的eclipse文件夹移动到目标目录中去,在这里我设定的安装目标为:/usr/local下。
$sudo mv eclipse /usr/local/
4.安装android sdk
解压android sdk包:
$unzip android-sdk-linux_x86-1.5_r2.zip
移动到目标目录:<在这里我将解压出的sdk文件夹目录改成了android-sdk>
$mv android-sdk-linux_x86-1.5_r2 android-sdk
$sudo mv android-sdk /usr/local/
5.配置环境变量:
修改~/.bashrc文件,加入android sdk与eclipse的环境变量。
$vi ~/.bashrc
在文件的最后加入
export PATH=/usr/local/android-sdk/tools:/usr/local/eclipse:$PATH
保存并退出vi
使配置信息生效
$source ~/.bashrc
6.android avd配置信息的生成
android avd的创建格式为:android create avd -n your-avd-name -t your-targets
其中:-n的参数为我们要创建的avd的名字;-t的参数为Available Android targets的id,我们可以使用命令:android list查寻其具体信息。
$android list

Available Android targets:
id: 1
Name: Android 1.1
Type: Platform
API level: 2
Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L, QVGA-L
id: 2
Name: Android 1.5
Type: Platform
API level: 3
Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L, QVGA-L
id: 3
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: QVGA-P, HVGA-L, HVGA (default), QVGA-L, HVGA-P
Available Android Virtual Devices:


下面我们就以创建一个android 1.5的avd为例:

$android create avd -n android-sdk-15 -t 2

Android 1.5 is a basic Android platform.
Do you wish to create a custom hardware profile [no]yes

Device ram size: The amount of physical RAM on the device, in megabytes.
hw.ramSize [96]:128

Touch-screen support: Whether there is a touch screen or not on the device.
hw.touchScreen [yes]:yes

Track-ball support: Whether there is a trackball on the device.
hw.trackBall [yes]:yes

Keyboard support: Whether the device has a QWERTY keyboard.
hw.keyboard [yes]:yes

DPad support: Whether the device has DPad keys
hw.dPad [yes]:yes

GSM modem support: Whether there is a GSM modem in the device.
hw.gsmModem [yes]:yes

Camera support: Whether the device has a camera.
hw.camera [no]:

Camera support: Whether the device has a camera.
hw.camera [no]:yes

Maximum horizontal camera pixels
hw.camera.maxHorizontalPixels [640]:854

Maximum vertical camera pixels
hw.camera.maxVerticalPixels [480]:480

GPS support: Whether there is a GPS in the device.
hw.gps [yes]:yes

Battery support: Whether the device can run on a battery.
hw.battery [yes]:yes

Accelerometer: Whether there is an accelerometer in the device.
hw.accelerometer [yes]:yes

Audio recording support: Whether the device can record audio
hw.audioInput [yes]:yes

Audio playback support: Whether the device can play audio
hw.audioOutput [yes]:yes

SD Card support: Whether the device supports insertion/removal of virtual SD Cards.
hw.sdCard [yes]:yes

Cache partition support: Whether we use a /cache partition on the device.
disk.cachePartition [yes]:yes

Cache partition size
disk.cachePartition.size [66MB]:100MB

Created AVD ''android-sdk-15'' based on Android 1.5

这样我们就创建了一个基于1.5的avd,上面的具体意思我想大家都能看懂,就不多说了。下在我们就可以测试一下android emulator了:

$emulator @android-sdk-15 -show-kernel

这样就可以启动android emulator了:

ubuntu9.04上android sdk 1.5 安装与配置_第1张图片
ubuntu9.04上android sdk 1.5 安装与配置_第2张图片

ubuntu9.04上android sdk 1.5 安装与配置_第3张图片

加入参数-show-kernel是为了在终端上打印android kernel的信息。

ubuntu9.04上android sdk 1.5 安装与配置_第4张图片

下面我们配置eclipse,使之支持android sdk:

打开Eclipse,Help->Software Updates->Available Software,点击
Add site,输入
http://dl-ssl.google.com/android/eclipse/

然后安装。完成后就可以开始在eclipse上建立android应用程序了。

参照:http://blog.mcuol.com/User/weishuangbo/Article/13320_1.htm

If you still cannot install ADT plugin and encounter the error message like this:
"

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
"
there may be miss some plugins in your eclipse
1. Go to "Help/Install New Software...
2. Add http://download.eclipse.org/releases/galileo/ to the update sites list(strange it's not installed by default on ubuntu)
3. From there, install WST (use the filter box to find the package)
4. Restart eclipse
5. Go back to "Help/Install New Software..." and install the Android ADT as explained on the android website.

OK, till here you may have a breath, an Android SDK with Eclipse IDE has been successfully installed in you Ubuntu system.
参照:http://blog.chinaunix.net/u3/104357/showart_2132259.html

Linux安装Android SDK时出现Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml

在Linux上面和Window上安装Android AVD Manager存在着一些差异:

Linux可切换到android sdk/tools目录下,执行android

1.$ cd ~/***/android-sdk/tools

2. $ android //就可打开android AVD manager

今天在ubuntu下使用AVD manager安装Android SDK2.0时,出现:
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml
按照提示,勾选了settings里面的:
Force https://... sources to be fetched using http://...,
并且点击了save&Apply,但是依旧提示:
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml
应该时设置的Force的功能没起作用,在网上搜了以下,有很多人遇到了类似的问题,Android官方也还没有提出解决方法,但是在Google Group中找到了一种方法(参见:http://groups.google.com/group/android-developers /browse_thread/thread/63a44163a8d07cd9?pli=1):
可以在执行android update sdk前,先在命令行中设置一个环境变量:
export GDK_NATIVE_WINDOWS=true
然后在执行android update sdk,设置Force https://... sources to be fetched using http://...,点击Save&Apply,就可以了。
其实我后来发现,不用设置什么环境变量也可以,出现上述问题的主要原因是,勾选了Force……之后,用鼠标点击Save&Apply按钮,没起 作用,应该是UI对单击事件没响应,有很简单的方法就是,用回车,因为勾选完,默认的选项按钮就是Save&Apply,直接回车就可以了,如果 不是默认按钮,可以先用鼠标点一下,使其变为当前选中按钮,然后回车就可以了

refer to : http://blog.csdn.net/JiangBo_HIT/archive/2009/11/24/4860996.aspx

after some effort, ah, finally can run hello android, congratulate you!

你可能感兴趣的:(android,sdk)