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

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

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

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

现象:安装ADT的时候会提示类似如下错误(版本号可能会有不同):

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

解决方案
方案1:直接从Eclipse官网下载完整的安装包
方案2:遵照以下菜单顺序或提示执行

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

相关参照
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)

sudo dpkg-reconfigure -plow dash

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)

chmod +x arm-2010.09-05-arm-none-linux-gnueabi.bin

4.4)

./arm-2010.09-05-arm-none-linux-gnueabi.bin

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

make crossall CPU_TARGET=arm OS_TARGET=linux OPT="-dFPC_ARMEL -O- -gl"  CROSSPORT="-O-" CROSSBINDIR=/home/victorhu/toolchain/arm-none-linux-gnueabi/bin

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

Program hello;
begin
writeln('Hello World!');
end.

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

./ppcrossarm -Tlinux -O- -XP -Fu/home/victorhu/fpc-source/rtl/units/arm-linux/ -FD/home/victorhu/toolchain/arm-none-linux-gnueabi/bin /home/victorhu/hello.pas

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.

./adb devices

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

./adb push ~/hello /data/hello

8.5) Run the program on the Android Emulator.

./adb shell data/hello

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 : 准备

sudo apt-get update

Step 1 : 安装 Java JDK & Eclipse

sudo apt-get install sun-java6-jdk eclipse

Step 2 : 安装 Andorid SDK Starter Package

wget http://dl.google.com/android/android-sdk_r06-linux_86.tgz
tar -zxvf android-sdk_r06-linux_86.tgz

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

Step 3 : 配置环境

export PATH=${PATH}:<android_sdk>/tools

如运行时出现”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应用程序开发

Leisure or busy?

最近挺闲的,自从冯如杯结束之后似乎就没什么比较正式的事情了(虽然冯如杯也是去水了一把~~),但是又越来越觉得有好多事情要做……

今天才把思修老师安排的翻译做完,《牛津通识读本-Marx》第八章,经济学,前6页,不是很多,翻译之后也就3000+字,不过挺痛苦的,遇到好多比较学术的东西,在网上查了很多资料,还有书架上沉寂已久的《资本论》(小狗送的,真有先见之明^-^)

加入的Podcast项目,还没能看到代码,却领到了写《需求规格说明书》和《软件开发计划书》的任务,暂时保留殴打逆铭大牛的权利,考虑到最近他和东东都比较忙,我们的美工大师喵喵又在忙着赚零花钱,我就只好先勉为其难了,Deadline是周五,今天周四……囧

数据库期中考试,上机考试,实践上应该没什么问题,只是有一些理论的东西没有很好的掌握,准备趁着期中考试的机会好好补习一下。还有经济管理、数学二学位好像都落了不少了,现在开始补?还是到期末?

GoogleCamp,策划活动好像进行的比较艰难,毕竟社团还在成长,难免会有问题吧,我相信我们会走过这道坎,我们是属于未来的!GCers加油!同年同月同日生的文文同学加油!比Hello Kity还可爱的娜娜加油!还有你们,曾经的9人组,虽然现在只有6个人了,但是我能感觉到,我们是一起的!

前天花了一个晚上时间把WP的各种函数和接口扫了一遍,Python和Android开发的学习似乎劲头还不是很足……就快五一了,就快要……我好平静下来,好好做自己的事情,不能太浮躁,听好了!你要好好努力!不仅是为了你自己……

浑浑噩噩ing

[废话当前]RSS订阅的问题似乎终于解决了,看到这篇post的朋友还望告之确认一下,谢谢啦~~

最近浑浑噩噩的,一直没闲着,回头想想却似乎只是在给自己的颓废找借口……小结一下

1、Golosim算法可视化开发,混了个二作的冯如杯项目,比较理论的一个东东,无线网络,随机路点模型、Ad Hoc,貌似很高深,但这次做的只是做了一个UI,加了自己用OpenGL开发的可视化模型,又用数据库实现了数据对比功能。

2、基于Google Earth的北航3D建模,没有混到作者名单的一个冯如杯项目(囧),和大一几个小朋友一起用sketchup建模,我做的是图书馆,效果还算不错。这个项目不是仅仅为冯如杯准备的,希望能很好的延续下去。

3、Google Camp,不得不承认在社长这个位置上我越来越觉得自己做的有问题了,胡乱的忙了好多,却没有很好的调动大家的积极性,虽然说课业太重是很大一部分原因,但是这不能否认我身上的问题,努力ing!

说一些或远或近的计划吧

1、Google Camp春季策划活动,进行中,暂不评论。

2、Android 开发,过段时间有一个Android开发大赛,钻研一下SDK和JAVA。

3、Python,只是寒假学了一会,开学之后忙着忙着就荒废了,重新拾起来,争取做一些东西。

4、Podcast,逆铭的项目,报了这学期所有要交大作业的课程,所以义不容辞参与进来,正好学一些协作开发经验。

5、和计院的一个实验室导师联系上了,主要研究方向是计算机图形学,OpenGL、DirectX……有的玩了~~

6、数据库、C#都是这学期比较重要的课程,虽然课堂本身显得很水,但还是有认真学习的必要的

7、数学二学位,荒废了好久了……数学和英语……是该努力了~~~