記錄了為FS_S5PC100平臺(tái)在Ubuntu下安裝Android Eclipse開發(fā)環(huán)境的搭建過程。使用Ubuntu版本為10.10,。 1,、安裝JDK (1) 安裝“Linux-Android\toolchain”目錄下的“jdk.bin”,jdk.bin是Jdk1.5,。Jdk1.5是編譯Android2.1必須的工具,,而且只能是1.5,其他版本(比如1.6)都不行,。 把“jdk.bin”拷貝到“/usr”目錄下,,然后執(zhí)行,按照提示安裝即可,。 #sudo ./jdk.bin (2)安裝結(jié)束后還要配置一下環(huán)境變量: ~$ sudo vim /etc/environment 將路徑(紅色字體)添加到PATH變量的最后面: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.2.2-eabi/usr/bin:/usr/jdk1.5.0_21/bin 保存退出后執(zhí)行: source /etc/environment 2,、安裝SDK 說明:最新的sdk可以到http://developer./sdk/index.html下載。這里用得是安裝包里的android-sdk-linux_x86-1.6_r1.tgz,。后面也會(huì)在eclipse 安裝完ADT后的Anroid SDK Manager中下載更新的SDK,。 (1)解壓android-sdk-linux_x86-1.6_r1.tgz到/home/linux下 (2)為了方便以后版本更新,創(chuàng)建一個(gè)軟連接 #ln -s android-sdk-linux_x86-1.6_r1 android-sdk (3)創(chuàng)建一個(gè)創(chuàng)建虛擬機(jī)平臺(tái) AVD linux@ubuntu:~/android-sdk/tools$ ./android create avd -n fs100 -t 2 Android 1.6 is a basic Android platform. Do you wish to create a custom hardware profile [no]y 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]:no Keyboard support: Whether the device has a QWERTY keyboard. hw.keyboard [yes]:n DPad support: Whether the device has DPad keys hw.dPad [yes]:y GSM modem support: Whether there is a GSM modem in the device. hw.gsmModem [yes]:n Camera support: Whether the device has a camera. hw.camera [no]:n Maximum horizontal camera pixels hw.camera.maxHorizontalPixels [640]: Maximum vertical camera pixels hw.camera.maxVerticalPixels [480]: GPS support: Whether there is a GPS in the device. hw.gps [yes]: Battery support: Whether the device can run on a battery. hw.battery [yes]: Accelerometer: Whether there is an accelerometer in the device. hw.accelerometer [yes]: Audio recording support: Whether the device can record audio hw.audioInput [yes]: Audio playback support: Whether the device can play audio hw.audioOutput [yes]: SD Card support: Whether the device supports insertion/removal of virtual SD Cards. hw.sdCard [yes]: Cache partition support: Whether we use a /cache partition on the device. disk.cachePartition [yes]: Cache partition size disk.cachePartition.size [66MB]: Abstracted LCD density: Must be one of 120, 160 or 240. A value used to roughly describe the density of the LCD screen for automatic resource/asset selection. hw.lcd.density [160]: Created AVD 'fs100' based on Android 1.6, with the following hardware config: hw.camera=no hw.ramSize=128 hw.touchScreen=yes hw.lcd.density=160 hw.gsmModem=no hw.keyboard=no hw.trackBall=no hw.dPad=yes (4)在主機(jī)上創(chuàng)建一個(gè) sd card image # sudo ./mksdcard 128M sdcard.img (5)啟動(dòng)虛擬機(jī) # sudo ./emulator -sdcard ./sdcard.img @fs100 3,、安裝Eclipse (1)http://www./downloads/packages/release/galileo/r 下載eclipse-SDK-3.5-linux-gtk.tar.gz 解壓至/home/linux目錄下 (2)創(chuàng)建工作目錄 #mkdir /home/linux/workspace (3)啟動(dòng)eclipse 進(jìn)入前面elipse的解壓目錄 #./eclipse 點(diǎn)擊help→Install New Software (注:https://dl-ssl.google.com/android/eclipse這個(gè)網(wǎng)址前段時(shí)間好像需要翻墻,。今天試了是可以的。如果輸入后,,長時(shí)間看不到顯示下圖的Developer Tools,,可能就需要翻墻了?;蛘甙補(bǔ)dt的壓縮包下載下來,,然后通過加archive的方法安裝了。) 點(diǎn)擊OK后,,選擇Developer Tools, 點(diǎn)擊next,,完成ADT安裝后,重新啟動(dòng)Eclipse (4)安裝完畢ADT后選擇重新啟動(dòng) 啟動(dòng)后會(huì)自動(dòng)彈出下面的界面,?;蜻x擇windows—>android sdk manager. 可以選擇前面安裝好的sdk路徑/home/linux/android-sdk. 可見前面安裝好的1.6的sdk已經(jīng)顯示安裝了。還可以針對(duì)目標(biāo)平臺(tái)安裝其它的sdk,。這里增加2.1的sdk 安裝完成后顯示下圖: (5)創(chuàng)建新的AVD,,支持2.1(前面創(chuàng)建的是1.6) 點(diǎn)擊Windows—>AVD manager 4,、創(chuàng)建HelloWord工程 (1)File→New→Project 選擇"Android" , "Android Project",點(diǎn)擊 next 命名為Hello World 點(diǎn)擊Next,,然后選擇Android 2.1 Finish以后就可以編輯工程了,。使用默認(rèn)的代碼就可以測試。 點(diǎn)擊run按鈕,,avd中顯示如下界面,。 生成apk文件在工作目錄下的位置: |
|