64位linux上的Android环境搭建手记
在Fedora 15 64bit操作系统上搭建一个Android的开发环境依照Android官方的指导能够顺利进行包括安装SDK,下载相关组件,安装ADT Plugin等。但在进入eclipse报了如下的一个错误,同时无法通过AVD运行Android的程序。
?
‘adb version’ failed!
/opt/android-sdk-linux_x86/platform-tools/adb:error while loading shared libraries:
libncurses.so.5: cannot open shared object file No such file or directory
?
通过ldd查看adb运行所需要的library,发现没找到libncurses.so.5和libstdc++.so.6两个文件:
[root@stream ~]# ldd /opt/android-sdk-linux_x86/platform-tools/adb?
linux-gate.so.1 => ?(0x00e71000)
librt.so.1 => /lib/librt.so.1 (0x0049e000)
libncurses.so.5 => Not Found
libpthread.so.0 => /lib/libpthread.so.0 (0x00cd7000)
libstdc++.so.6 =>?Not Found
libm.so.6 => /lib/libm.so.6 (0x009cd000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00916000)
libc.so.6 => /lib/libc.so.6 (0x48f92000)
/lib/ld-linux.so.2 (0x48f71000)
libdl.so.2 => /lib/libdl.so.2 (0x00223000)
libtinfo.so.5 => /lib/libtinfo.so.5 (0x00c2a000)
在网络上搜索,才发现如果要在64位linux下使用32位的SDK进行开发必须安装如下的32位的包(参考:http://crashcourse.ca/android-64-bit-fedora/android-sdk):
# yum install glibc.i686# yum install glibc-devel.i686# yum install libstdc++.i686# yum install zlib-devel.i686# yum install ncurses-devel.i686# yum install libX11-devel.i686
由于之前我已经安装过64位的libstdc++的版本,导致使用
# yum install glibc-devel.i686
安装时出现如下的错误:
错误:Protected multilib versions: libstdc++-4.6.0-10.fc15.i686 != libstdc++-4.6.0-6.fc15.x86_64
?You could try using --skip-broken to work around the problem
?You could try running: rpm -Va --nofiles --nodigest
?
接着使用模糊匹配的方式进行安装,就会将32位安装
# yum install libstdc++*;
然后通过ldd工具查看,发现所有的library都找到了[stream@stream ~]$ ldd /opt/android-sdk-linux_x86/platform-tools/adb?linux-gate.so.1 => ?(0x00740000)librt.so.1 => /lib/librt.so.1 (0x0078d000)libncurses.so.5 => /lib/libncurses.so.5 (0x00a91000)libpthread.so.0 => /lib/libpthread.so.0 (0x00e52000)libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00110000)libm.so.6 => /lib/libm.so.6 (0x003d3000)libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00d42000)libc.so.6 => /lib/libc.so.6 (0x48f92000)/lib/ld-linux.so.2 (0x48f71000)libdl.so.2 => /lib/libdl.so.2 (0x00ca3000)libtinfo.so.5 => /lib/libtinfo.so.5 (0x0070c000)OK,大功告成。