解决在Ubuntu上搭建Android开发环境缺少WST包的问题

前言:之前写过一篇《Ubuntu 10.04安装Android开发环境》,每天都有不少访问量,估计很多就是遇到了这个问题,一直压在Evernote里没有翻出来,现在已转入Arch阵营,没有再次验证解决方案的正确性,完全参照印象和笔记,有问题尽管留言

平台:Ubuntu 10.10和Ubuntu 11.04,10.04(写那一篇日志的时候)无此问题

原因:Ubuntu下的Eclipse是Ubuntu社区打包的,非完整版,少了WST包的支持

现象:安装ADT的时候会提示类似如下错误(版本号可能会有不同):
[text gutter=”false”]
Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 10.0.1.v201103111512-110841 (com.android.ide.eclipse.adt.feature.group 0.0.1.v201103111512-110841) Missing requirement: Android Development Tools 10.0.1.v201103111512-10841 (com.android.ide.eclipse.adt.feature.group 10.0.1.v201103111512-110841) requires ‘org.eclipse.wst.sse.core 0.0.0’ but it could not be found
[/text]
解决方案
方案1:直接从Eclipse官网下载完整的安装包
方案2:遵照以下菜单顺序或提示执行
[text gutter=”false”]
1:Help –> Install New Software –> Add –> type ‘http://download.eclipse.org/releases/galileo’ in the Location –>OK
2:Help –> Install New Software –> Add –> type ‘http://dl.google.com/eclipse/plugin/3.5’ in the Location –> OK
3:Please make sure the option ‘Contact all updates sites during install to find required software’ is checked.
4:Restart Eclipse,Reinstall ADT
[/text]
相关参照
1)http://code.google.com/intl/es/eclipse/docs/faq.html#wstinstallerror
2)http://code.google.com/intl/es/eclipse/docs/install-eclipse-3.5.html

P.S.本文参与“第二届 Google 暑期大学生博客分享大赛 – 2011 Android 成长篇”,感谢大家支持

Android平台下FreePascal的交叉编译器

0) Preface
0.1) The Operating System is Ubuntu 10.10
0.2) All the softwares are the latest stable version by April 12, 2011

1) Download the Source of Free Pascal Compiler
The ‘fpc-2.4.2.source.tar.gz’ on http://sourceforge.net/projects/freepascal/files/Source/2.4.2/

2) Install the fpc-source. Just extract it.
The root folder of fpc-source for me is ‘/home/victorhu/fpc-source’

3) Download the Arm-Eabi (Sourcery G++ Lite 2010.09-50 for ARM GNU/Linux)
The ‘IA32 GNU/Linux Installer’ on http://www.codesourcery.com/sgpp/lite/arm/portal/release1600

4) Install the Arm-Eabi (Sourcery G++ Lite 2010.09-50 for ARM GNU/Linux)
The installation need the system shell to be bash not dash which is default for Ubuntu. So
4.1)

Choose NO to make the bash as the system shell.
4.2) Goto the root folder of Arm-Eabi for me is ‘/home/victorhu/toolchain/’
4.3)

4.4)

5) Get the Cross Compiler
5.1) Goto the root folder of fpc-source
5.2)

5.3) The ‘ppcrossarm’ under ‘/home/victorhu/fpc-source/compilers/’ is just what we want.
Note: CROSSBINDIR is depend on the folder of Arm-Eabi.

6) Write a Hello Word in Pascal
The path for me is /home/victorhu/hello.pas

7) Compile the Hello World in Pascal via CrossCompile Environment.
7.1) Goto the folder contains ‘ppcrossarm’
7.2)

Note: -Fu is the unit path, -FD is the compiler utilities path.
7.3) The ‘hello’ under ‘/home/victorhu/temp’ is just the what we want (not hello.pas).

8) Test the Crosscompiled Hello World in Android Emulator
8.1) the tools under Android SDK or the ADT of Eclipse is where we can find it.
8.2) Goto the adb root folder under Android SDK .
It’s ‘platform-tools’ under the main root folder of Android SDK now while it’s ‘tools’ before.
8.3) Test whether is device is connected.

If it shows somthing like ‘Emulator-5544 device’ (for me), then it’s right.
8.4) Push the program into Android Emulator.

8.5) Run the program on the Android Emulator.

If it shows ‘Hello World!’ (the result of the original program), then everything is done now!

9) Reference
9.1) http://alexmogurenko.com/blog/programming/android-building-free-pascal-compiler-for-android/
9.2) http://wiki.freepascal.org/Android_Interface
9.3) http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM

P.S.本文参与“第二届 Google 暑期大学生博客分享大赛 – 2011 Android 成长篇”,感谢大家支持

Ubuntu 10.04安装Android开发环境(更新解决WST包缺少问题)

更新:在10.10及11.04中搭建时可能会遇到WST包缺少的问题,可以参照这篇日志解决

注:本文中<android_sdk>代表Android SDK安装路径
这里选择”/home/victorhu/Code/android-sdk-linux_86″

Step 0 : 准备

Step 1 : 安装 Java JDK & Eclipse

Step 2 : 安装 Andorid SDK Starter Package

你可以把这个文件放在任意你希望的位置,这就是Andord SDK的安装位置

Step 3 : 配置环境

如运行时出现”The project cannot be built until build path errors are resolved”错误,请检查此步

Setp 4 : 安装 ADT Plugin for Eclipse
在Eclipse中选择”Help” –> “Install New Software”将出现类似下方画面
1
在”Work with”区域填上”https://dl-ssl.google.com/android/eclipse/”然后选择”Add”
此时会显示类似上方的画面,勾选”Develop Tools”点击”Next”,剩余步骤同一般程序安装
更新:如果此处遇到WST包缺少的问题,可以参照这篇日志解决
(可能会遇到证书错误,选择继续安装即可)

Step 5 : 配置 SDK
在Eclipse中选择”Windows” –> “Preferences”,然后在左侧选择”Android”可得到类似下方画面
2
点击”Browse”选择Android SDK安装路径,此时会在”SDK Location”处显示,点击”Apply”使配置生效

Step 6 : 下载 SDK package
在Eclipse中选择”Windows” –> “Android SDK and AVD manager”,在左侧选择”Available”
选择所有(如下图所示),然后开始安装”Install Selected”
3
附两张过程中的截图: 1、选择”Accept All”比较方便; 2、下载可能需要花费比较长的时间
4

5

至此,Andorid的开发环境安装成功

Step 7 : 导入Sample
1、新建工程,选择”Android Project”(如下图)
6
2、在”Contents”中选择”Create project from existing source”,
在”Location”中选择Samples的文件夹,这里选择”<android_sdk>/samples/android-7/Home”
在”Build Target”中选择开发平台,这里选择”Android 2.2″(截图如下)
7

Step 8 : 新建AVD(Android Virtual Device)
在Eclipse中选择”Windows” –> “Android SDK and AVD manager”,在左侧选择”Virtual Devices”,然后选择右侧的”New”(截图如下)
8
相关设置:
1、Name,任意但有限制,不可以有空格、点等一些特殊字符
2、Target,需要和刚才选择的”Build Target”一致
3、SD Card,设定给Android分配的SD卡内存容量,这里选择1G(1024MB)
其他的默认即可(截图如下)
9

Step 9 : 运行
找到运行按钮,或者直接Ctrl+F11,稍微等待一下编译过程,然后即可出现Android的运行界面,附截图两枚
10

11

至此,所有工作基本完成,有了Documentation、Samples,Android的大门已经打开了!

参考资料:
1、Installing the SDK | Android Developers
2、《
Android应用程序开发