eclipse配置Android或OPhone提示Failed to find an AVD compatible with target 'Android 1.5'. Launch aborted.

 

Part I:安装JDK 6.0

在Android SDK 1.5里运行Amulator需要AVD(Android Virture Device)。创建AVD依赖JAVA命令,所以首先需要在Linux中安装JDK。
java.sun.com/javase/downloads/index.jsp 下载JDK 6.0;

[root@localhost usr]#cp ~/android/jdk-6u14-linux-i586.bin /usr
[root@localhost usr]# sh jdk-6u14-linux-i586.bin
这时会解压生成目录/usr/jdk1.6.0_14,然后在.bash_profile中 添加环境变量:
JAVA_HOME=/usr/jdk1.6.0_14
PATH=$PATH:$HOME/bin:/usr/local/arm_tools/bin:/opt/codesourcery/bin/:$JAVA_HOME/bin
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH

删除系统默认安装的java:
[root@localhost jdk1.6.0_14]# rpm -qa | grep java
gcc-java-3.4.6-3
java-1.4.2-gcj-compat-1.4.2.0-27jpp
[root@localhost jdk1.6.0_14]# rpm -e java-1.4.2-gcj-compat-1.4.2.0-27jpp
[root@localhost jdk1.6.0_14]# source ~/.bash_profile
测试安装:
[root:/root/android]#java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
[root:/root/android]#javac -version
javac 1.6.0_14

Part II: 安装android交叉编译器


到google android官方站点下载交叉编译器android-toolchain-20081019-src.tar.bz2并解压缩:
[root@localhost src]#tar -xjf ~/winxp/android/backup/android-toolchain-20081019-src.tar.bz2
[root@localhost src]#cd /usr/local/src/android-toolchain-20081019/
[root@localhost android-toolchain-20081019]#mkdir -p /usr/local/android_tools/
[root@localhost android-toolchain-20081019]#./configure --target=arm-android-eabi --prefix=/usr/local/android_tools
[root@localhost android-toolchain-20081019]#make;make install

这时会安装交叉编译器到/usr/local/android_tools下。修改~/.bash_profile,添加交叉编译器路径到path下就OK了。
[guowenxue@localhost ~]$ arm-android-eabi-gcc -v
Using built-in specs.
Target: arm-android-eabi
Configured with: .././gcc-4.2.1/configure --prefix /usr/local/toolchain-android/ --program-transform-name=s,^,arm-android-eabi-, --prefix=/usr/local/toolchain-android/ --target=arm-android-eabi --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --enable-languages=c,c++ --disable-libstdc__-v3 --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp
Thread model: single
gcc version 4.2.1

注: 尝试使用交叉编译器android-ndk-toolchain-20090323-src.tar.bz2,无论使用gcc-4.2.1还是gcc-4.3.1都告失败;也许不应该在android-ndk-toolchain下编译,而应该进入到gcc-4.{2/3}.1里编译。

1,在编译gcc-4.3.1时,会提示找不到文件libgcc.mvars文件,将gcc-4.3.1/host-i686-pc-linux-gnu/gcc/libgcc.mvars复制到gcc-4.3.1/gcc/可以继续下去。即使这样,还是会遇到下面这个问题:

2,继续编译时,会出现stdio.h等头文件找不到,不过可以修改gcc-4.{2/3}.1/host-i686-pc-linux-gnu/gcc/Makefile中编译源码处添加 -${srcdir}/../fixincludes/tests/base(缺少的头文件都在这里) 来解决,只是后面继续报了太多错误就没有go on了。

3,在编译android-toolchain-20081019这个交叉编译器时,不能指定--target=arm-eabi, 而应该指定--target=arm-android-eabi,否则编译会报错。


PART III. 创建AVD


此前一直没有创建sdcard.img,而直接使用android create avd -n AVD1.5 -t 2命令来创建AVD。结果在运行命令emulator -avd AVD1.5启动模拟器时时,总是提示有AVD中有非法字符。用下面这个过程来创建AVD是OK的。
[root@localhost ~]# mksdcard 512M /android/sdcard.img
[root@localhost ~]# android create avd -n AVD1.5 -c /android/sdcard.img -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]:256

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]:yes

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]: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]:

Created AVD 'AVD1.5_500M' based on Android 1.5

列出所有的AVD
[root@localhost ~]#android list avd
Available Android Virtual Devices:
    Name: AVD1.5
    Path: /root/.android/avd/AVD1.5.avd
Target: Android 1.5 (API level 3)
    Skin: HVGA
Sdcard: 500M
[root@localhost ~]#android delete avd -n AVD1.5
AVD 'AVD1.5_500M' deleted.


PART IV:   运行模拟器,编译Linux内核

在SecureCRT上使用SSH 登录后运行emulator出错:
SDL init failure, reason is: No available video device.
原因是他依赖X11,所以只得进入图形化界面来运行:
[root@localhost ~]## emulator -avd AVD1.5
ALSA lib pcm_hw.c:1155:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
ALSA lib pcm_hw.c:1155:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
ALSA lib pcm_hw.c:1155:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
ALSA lib pcm_hw.c:1155:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
emulator: emulator window was out of view and was recentred

这时模拟器跑了起来,现在再用另外一个Terminal来获取内核配置文件:config.gz
[root@localhost ~]# adb pull /proc/config.gz .
* daemon not running. starting it now *
* daemon started successfully *
44 KB/s (6549 bytes in 0.143s)
[root@localhost ~]# ls
android bin config.gz Desktop hello.c makefile nfs-15 winxp
[root@localhost ~]# gzip -d config.gz
[root@localhost ~]# ls
android bin config Desktop hello.c makefile nfs-15 winxp

将config文件copy到linux-2.6.25-android的内核树中,重命名为.config。并修改Makefile文件,指定:
ARCH            ?= arm
CROSS_COMPILE   ?= arm-none-eabi-

在make 之后会生成内核镜像文件:linux-2.6.25-android/arch/arm/boot/zImage,将其copy出来后使用emulator来运行。

[root@localhost ~]#emulator @AVD1.5 -kernel ~/zImage -show-kernel
emulator: emulator window was out of view and was recentred

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
Machine: Goldfish
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-through cache
CPU0: I cache: 4096 bytes, associativity 4, 32 byte lines, 32 sets
CPU0: D cache: 65536 bytes, associativity 4, 32 byte lines, 512 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: qemu=1 console=ttyS0 android.checkjni=1 android.qemud=ttyS1 android.ndns=1
Unknown boot option `android.checkjni=1': ignoring
Unknown boot option `android.qemud=ttyS1': ignoring
Unknown boot option `android.ndns=1': ignoring
PID hash table entries: 1024 (order: 10, 4096 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 256640KB available (2348K code, 443K data, 96K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
checking if image is initramfs... it is
Freeing initrd memory: 142K
goldfish_new_pdev goldfish_interrupt_controller at ff000000 irq -1
goldfish_new_pdev goldfish_device_bus at ff001000 irq 1
goldfish_new_pdev goldfish_timer at ff003000 irq 3
goldfish_new_pdev goldfish_rtc at ff010000 irq 10
goldfish_new_pdev goldfish_tty at ff002000 irq 4
goldfish_new_pdev goldfish_tty at ff011000 irq 11
goldfish_new_pdev smc91x at ff012000 irq 12
goldfish_new_pdev goldfish_fb at ff013000 irq 13
goldfish_new_pdev goldfish_mmc at ff005000 irq 14
goldfish_new_pdev goldfish_memlog at ff006000 irq -1
goldfish_new_pdev goldfish-battery at ff014000 irq 15
goldfish_new_pdev goldfish_events at ff015000 irq 16
goldfish_new_pdev goldfish_nand at ff016000 irq -1
goldfish_new_pdev goldfish-switch at ff017000 irq 17
goldfish_new_pdev goldfish-switch at ff018000 irq 18
goldfish_pdev_worker registered goldfish-switch
goldfish_pdev_worker registered goldfish-switch
goldfish_pdev_worker registered goldfish_nand
goldfish_pdev_worker registered goldfish_events
goldfish_pdev_worker registered goldfish-battery
goldfish_pdev_worker registered goldfish_memlog
goldfish_pdev_worker registered goldfish_mmc
goldfish_pdev_worker registered goldfish_fb
goldfish_pdev_worker registered smc91x
goldfish_pdev_worker registered goldfish_tty
goldfish_pdev_worker registered goldfish_tty
goldfish_pdev_worker registered goldfish_rtc
ashmem: initialized
goldfish_pdev_worker registered goldfish_timer
goldfish_pdev_worker registered goldfish_device_bus
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
yaffs Jul 20 2009 22:20:24 Installing.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered
goldfish_pdev_worker registered goldfish_interrupt_controller
allocating frame buffer 320 * 480, got ffc00000
console [ttyS0] enabled
brd: module loaded
nbd: registered device at major 43
No IRQF_TRIGGER set_type function for IRQ 12 (goldfish)
eth0: SMC91C11xFD (rev 1) at d0800000 IRQ 12 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
goldfish nand dev0: size 4000000, page 2048, extra 64, erase 131072
goldfish nand dev2: size 4000000, page 2048, extra 64, erase 131072
mice: PS/2 mouse device common for all mice
*** events probe ***
events_probe() addr=0xd0804000 irq=16
events_probe() keymap=qwerty2
mmcblk0: mmc0:e118 SU02G 524288KiB
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
IPv4 over IPv4 tunneling driver
NET: Registered protocol family 1
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
Freeing init memory: 96K
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.0, "mtdblock0"
yaffs: dev is 32505857 name is "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.1, "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'

Andriod For FreeRunner (S3C2410):

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值