InsideAndroidlabnotesWhatelsecanyoudowithAndroidEmbeddedLinuxConferenceEurope2010Date:Tuesday26thOctoberLocation:DeVereUniversityofArmsHotel,CambridgeRoom:ChurchillSuitePresenter:ChrisSimmonds,chis@2net.
co.
ukCopyright2010,2netLimited1.
MakinguseofAndroidNOTE:ItestedtheseinstructionsusingUbuntu10.
04Desktopi386.
TheyshouldworkonotherLinuxconfigurationstoo,withmaybealittletweaking.
InthissectionyouwillinstalltheAndroidSDK,createadefinitionofavirtualdeviceandruntheemulatorInstallJDKYouwillneedaversionoftheSunJavaDevelopmentKit.
OtherversionsofJavawillnotwork.
Thereisachoicehere:ifyouonlywanttoinstallandusetheSDKforwritingAndroidappsthenJava6isthebestchoice.
But,ifyouwanttobuildthefullAndroidrun-time,asyouwillifyouareportingtocustomhardware,thenyouwillneedJava5.
ToinstallJava6onUbuntujusttypesudoapt-getinstallsun-java6-jdkNote:requiresthatyougotoSynaptic->Settings->RepositoriesandontheOthersoftwaretab,enablehttp://archive.
canonical.
com/ubuntuandthenreloadtherepositories.
ToinstallJava5.
.
.
DownloadasuitableJDKfromjava.
sun.
com,e.
g.
jdk-5u25-linux-i586.
bin,then:cd~shDownloads/jdk-5u25-linux-i586.
bin-1-InsideAndroidlabnotesSettheseshellvariablesexportJAVA_HOME=$HOME/jdk1.
5.
0_22PATH=$JAVA_HOME/bin:$PATHHint:addthelinesabovetoyour.
profilesotheyaresetcorrectlyeachtimeyoulogin.
InstalltheAndroidSDKDownloadtheSDK"starterpack"fromhttp://developer.
android.
com/sdk/index.
html.
Atthetimeofwritingthecurrentversionwasr06.
Then:cd~tarxzfDownloads/android-sdk_r06-linux_86.
tgzcdandroid-sdk-linux_86PATH=$HOME/android-sdk-linux_86/tools:$PATHThestarterpackcontainslittlebesidesthetoolsdirectory;youneedtoinstallatleastoneSDKplatform.
ThereisoneplatformforeachAndroidrelease.
Inthiscaseyouaregoingtoinstallthe2.
2"Froyo"platform.
Run"android"withnoparameterssoitstartsinGUImode.
Fromthe"AvailablePackages"list,select"SDKPlatformAndroid2.
2,API8,revision2"&install.
CreateanAVDSinceyouintendtousetheemulator,youneedtocreateadefinitionofthetargetdeviceyouaregoingtoemulate.
ThisiscalledanAVD:AndroidVirtualDevice.
Youcandoitusingthegraphicaluserinterfacetheandroidtoolprovides:select"VirtualDevices"andclickthe"New.
.
.
"button.
Oryoucandoitfromthecommandlinewithandroidcreateavd-nAVDtest-t1where-ngivestheAVDanameand-tselectsthetargetplatform.
Run"androidlist"togetalistoftargetplatformids.
Use"androidlistavd"foralistofthemIfyouarecurious,theAVDiscreatedin$HOME/.
android/avdandconsistsofaconfigurationfileandaplacefortheemulatortokeepuserdata.
-2-InsideAndroidlabnotesRuntheemulatoremulator-avdAVDtestNote:thesecondtimeyoubootthedevicethescreenwillbelocked.
Youunlockitbypressingthemenukey.
OtherthingsyoucandoExperimentwithAVDsettingsWhenyoucreateanAVDyoucanspecifyaskin.
ThedefaultisHVGAwhichis320x480.
OtheroptionsincludeQVGA(240x320,lowdensity,smallscreen)HVGA(320x480,mediumdensity,normalscreen)WVGA800(480x800,highdensity,normalscreen)WVGA854(480x854highdensity,normalscreen)Youcanspecifyotherskinsbyname,e.
g.
WVGA(800x480)orbyresolution.
YoucanspecifyanSDcardsizeandimagefile.
.
.
Starttheemulatorwith-shelltogetarootshell.
Starttheemulatorwith-show-kerneltoseethekernelmessagesastheemulatorboots.
InstallEclipseandtheADTIfindthattheeasiestwaytodeployEclipseistoextractthearchivetoyourhomedirectoryandlaunchitwiththe-vmoptionpointingtotheJavabinary:cd~tarxzfDownloads/eclipse-java-helios-linux-gtk.
tar.
gzeclipse/eclipse-vmjdk1.
5.
0_22/bin/javaInEclipse,gotoHelp->Installnewsoftware.
SettheURLto"Workwith"tohttps://dl-ssl.
google.
com/android/eclipse/Select"DeveloperTools"andclickInstall.
Installastatically-linkedcopyofBusyboxBusyboxcontainsalotofusefulUnixcommandsthataremissingfromAndroid,plusithasadecentshellwithpropercommandlineediting.
tarxjfbusybox-1.
16.
1.
tar.
bz2cdbusybox-1.
16.
1/makemenuconfigInBusyboxSettings->BuildOptionsselectBuildBusyBoxasastaticbinaryandexecprefersapplets,then-3-InsideAndroidlabnotesmakeCopyittoAndroidadbshellmkdir/data/binexitThencopybusybox:adbpushbusybox/data/binNowyoucanrunbusyboxfromtheAndroidshellandgetittorunaniceashshellforyou:/data/bin/busyboxash-4-InsideAndroidlabnotes2.
MakingUseofAndroidHelloWorldIfyoudon'thaveitalready,installant:sudoapt-getinstallantGetalistofAndroidSDKversionsinstalledonyourlaptop:$androidlisttargetsAvailableAndroidtargets:id:1or"android-8"Name:Android2.
2Type:PlatformAPIlevel:8Revision:2Skins:WQVGA432,QVGA,WVGA854,WQVGA400,WVGA800,HVGA(default)Inthiscasethereisonlyone,andithasanidof1.
Createaprojectusingthistarget:androidcreateproject--target1--nameHello\--path.
/helloworld--activityHelloWorld\--packagecom.
example.
HelloWorldNotethatthedirectoryhelloworld/hasbeecreatedandcontainsaskeletonproject.
Edithelloworld/src/com/example/HelloWorld/HelloWorld.
javaandaddaTextViewasshownintheslides.
BuilditbytypingantdebugNotethathelloworld/bin/Hello-debug.
apkhasbeencreated.
Starttheemulatorandinstallyourpackageadbinstall-rbin/Hello-debug.
apkIntheemulator,clicktheapplicationlaunchericon:Youshouldseeyourapplicationthere,soclickit!
NativecodeDownloadacopyofthendkfromhttp://developer.
android.
com/sdk/ndk/index.
html.
Extractittoyourhomedirectorycd~unzipDownloads/android-ndk-r4b-linux-x86.
zipNextyouaregoingtobuildoneofthesampleapplications,HelloJni.
CreateanewAndroidproject-5-InsideAndroidlabnotescd~mkdirappscdappsandroidcreateproject--target1--nameHelloJni--path.
/hello-jni--activityHelloJni--packagecom.
example.
hellojniCopythendksamplecodeoverthetopcp~/android-ndk-r4b/samples/hello-jni/*hello-jniBuildthenativecode.
.
.
cd~/apps/hello-jni~/android-ndk-r4b/ndk-buildBuildtheprojectantdebugRuntheemulatorandtheninstalltheprojectadbinstall-rbin/Hellojni-debug.
apkTestthatitworks.
Youshouldseethestring"HellofromJNI!
"onthescreenandifyourunlogcatyoushouldseesomethinglikethis:I/ActivityManager(58):Startproccom.
example.
hellojniforactivitycom.
example.
hellojni/.
HelloJni:pid=453uid=10013gids={1015}D/dalvikvm(453):Tryingtoloadlib/data/data/com.
example.
hellojni/lib/libhello-jni.
so0x43e372e8D/dalvikvm(453):Addedsharedlib/data/data/com.
example.
hellojni/lib/libhello-jni.
so0x43e372e8D/dalvikvm(453):NoJNI_OnLoadfoundin/data/data/com.
example.
hellojni/lib/libhello-jni.
so0x43e372e8,skippinginitI/ActivityManager(58):Displayedactivitycom.
example.
hellojni/.
HelloJni:1049ms(total1049ms)-6-InsideAndroidlabnotes3.
PortingtocustomhardwareMergingtheAndroidkernelThisisaquestionofjugglingwiththreeorfourkerneltrees.
Theyare1.
kernelforyourboard2.
themainlinekernelitwasbasedon3.
theandroidkernel4.
themainlinekernelitwasbasedonItmakeslifesimplerifthemainlinekernelisthesameinbothcases:/-->boardkernelmainlinekernel\-->AndroidkernelInthiscase,you"just"needtocreateapatchofdifferencesbetweenAndroidandmainlineandapplyittothekernelforyourboard,andthenclearupanyconflicts.
SimpleNo,buttomakelifeabiteasierherearesomehints.
Installgitifyoudon'thaveitalreadysudoapt-getinstallgitClonetheAndroidkerneltree(thiswilltakeawhile):gitclonegit://android.
git.
kernel.
org/kernel/common.
gitandroid-kernelListthebranches:cdandroid-kernelgitbranch-a*android-2.
6.
27remotes/origin/HEAD->origin/android-2.
6.
27remotes/origin/android-2.
6.
25remotes/origin/android-2.
6.
27remotes/origin/android-2.
6.
29remotes/origin/android-2.
6.
32remotes/origin/android-2.
6.
35remotes/origin/android-goldfish-2.
6.
27remotes/origin/android-goldfish-2.
6.
29Thissaysthatthecurrentbranchisandroid-2.
6.
27.
Supposeyouwanttouseandroid-2.
6.
32asabase,createanewlocalbranch,namedandroid-2.
6.
32inthiscase,whichisbasedonremotebranchorigin/android-2.
6.
32:gitcheckout--track-bandroid-2.
6.
32origin/android-2.
6.
32Nowgitbranch-awillconfirmthatyouareonandroid-2.
6.
32.
-7-InsideAndroidlabnotesThenextstageistofindthedifferencesbetweenthemainlineandAndroidkernels.
Firstyouneedtosynchronisethetagswiththemainlinekernel(ifyoulistthetagswith"gittag-l"youwillseethatmorerecentonesaremissing):gitfetch--tagsgit://git.
kernel.
org/pub/scm/linux/kernel/git/stable/linux-2.
6.
32.
y.
gitNow,sayyouwanttogeneratealistofpatchesuptomainline2.
6.
32.
9:gitformat-patchv2.
6.
32.
9.
.
HEADThenapplythesepatchestothekernelforyourboard:cdyour-kernelforfinandroid-kernel/*.
patch;dopatch-p1http://android.
git.
kernel.
org/repo>~/bin/repochmoda+x~/bin/repomkdirworking-directory-namecdworking-directory-namerepoinit-ugit://android.
git.
kernel.
org/platform/manifest.
gitThen,synchronisewithreposync(NotethiswilltakequitealongtimethefirsttimebecauseitwilldownloadseveralGiBofcode)RepoManifestsRepoisawayofmanagingmultiplegitrepositories.
Thelistofrepositoriesisheldinamanifest,whichisatextfileinxmlformat.
Whenyoucreatearepositoryusing"repoinit"youneedtogiveamanifest,defaultis"default.
xml".
Adda-mtospecifyadifferentmanifest,e.
g.
repoinit-ugit://android.
git.
kernel.
org/platform/manifest.
git-mdalkvik-plus.
xmlTospecifyarevision,thatis,aparticularmanifest-branch,usethe-boption.
Forexample:-8-InsideAndroidlabnotesrepoinit-ugit://android.
git.
kernel.
org/platform/manifest.
git-brelease-1.
0Youcanviewthemanifestusedwhentherepowasinitialisedbylookingin.
repo/manifest.
xmlBuildingthedefault(generic)productTypecdmyandroidexportJAVA_HOME=$HOME/jdk1.
5.
0_22PATH=$JAVA_HOME/bin:$PATH.
build/envsetup.
shmCompilestherun-timetoolsandfilesystem:myandroid/out/host/linux-x86-tools,e.
g.
adbmyandroid/out/target-targetrun-timeimages:target/product/generic/system.
img,userdata.
img,ramdisk.
imgmyandroid/target/product/generic/root/-rootfsTocreatethesdk,typemakesdkresultisinout/host/linux-x86/android-sdk_eng.
chris_linux-x86/andarezippedupintoPackageSDK:out/host/linux-x86/sdk/android-sdk_eng.
chris_linux-x86.
zip-9-
justhost.ru官方来消息说已经对网络进行了比较全面的优化,针对中国电信、联通、移动来说,4个机房总有一个适合中国用户,让站长进行一下测试,这不就有了这篇有关justhost的VPS的第四次测评。本帖主要关注的是网络,对于其他的参数一概不管! 官方网站:https://justhost.ru 最低配VPS:8.3元/月,KVM,512M内存,5G硬盘,200M带宽,不限流量 购买链接:...
DediPath 商家成立时间也不过三五年,商家提供的云服务器产品有包括KVM和OPENVZ架构的VPS主机。翻看前面的文章有几次提到这个商家其中机房还是比较多的。其实对于OPENVZ架构的VPS主机以前我们是遇到比较多,只不过这几年很多商家都陆续的全部用KVM和XEN架构替代。这次DediPath商家有基于OPENVZ架构提供低价的VPS主机。这次四折的促销活动不包括512MB内存方案。第一、D...
香港大带宽服务器香港大带宽云服务器目前市场上可以选择的商家十分少,这次给大家推荐的是我们的老便宜提速啦的香港大带宽云服务器,默认通用BGP线路(即CN2+BGP)是由三网直连线路 中国电信骨干网以及HGC、NTT、PCCW等国际线路混合而成的高品质带宽(精品带宽)线路,可有效覆盖全球200多个国家和地区。(适用于绝大部分应用场景,适合国内外访客访问,域名无需备案)提速啦官网链接:点击进入香港Cer...
http://www.xiaomi.com/为你推荐
haole018.com为什么www.haole008.com在我这里打不开啊,是不是haole008换新的地址了?www.qq530.com谁能给我一个听歌的网站?网站检测如何进行网站全面诊断haole16.com国色天香16 17全集高清在线观看 国色天香qvod快播迅雷下载地址www.ijinshan.com桌面上多了一个IE图标,打开后就链接到009dh.com这个网站,这个图标怎么删掉啊?机器蜘蛛挑战或是生存Boss是一只巨型机器蜘蛛的第一人称射击游戏叫什么www.1diaocha.com哪个网站做调查问卷可以赚钱 啊59ddd.comarmada m300什么装系统本冈一郎本冈一郎有副作用吗?主要有什么呢?汴京清谈汴京繁华 简介50字?
抗投诉vps主机 工信部域名备案系统 pccw 英文简历模板word 英语简历模板word 美国php主机 免费个人空间申请 厦门电信 cloudlink 丽萨 dnspod 中国域名 阵亡将士纪念日 大化网 好看的空间 rewritecond hdsky SmartAXMT800 蓝队云 九零网络 更多