1. 错误
Android build tools更新到24.0.3后,使用Jenkins打包,报以下错误,但在本地打包时一切正常。
AAPT err(Facade for 555668920): /var/lib/jenkins/.android-sdk/build-tools/24.0.3/aapt: /lib64/libc.so.6: version 'GLIBC_2.14' not found (required by /var/lib/jenkins/.android-sdk/build-tools/24.0.3/aapt)
2. 原因
报此错误原因是由于打包服务器的CentOS系统版本太老(CentOS 6.7 Final),AAPT需要2.14版本的glibc库,而系统最高支持到2.12版本(使用yum能够获取到的最新版本为2.12),所以只能升级系统到新版本或者下载glibc的源码手动编译安装。
通过以下命令查看当前系统glibc支持的版本:
strings /lib/libc.so.6 | grep GLIBC
GLIBC_2.0
GLIBC_2.1
GLIBC_2.1.1
GLIBC_2.1.2
GLIBC_2.1.3
GLIBC_2.2
GLIBC_2.2.1
GLIBC_2.2.2
GLIBC_2.2.3
GLIBC_2.2.4
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE
参考:
- Android Studio not communicating with adb GLIBC … not found error
- adb fails to run on CentOS 6.7 (GLIBC_2.14, GLIBC2_15 not found)
3. 解决
3.1 下载glibc源码编译安装。
到 http://www.gnu.org/software/libc/ 下载新版本的glibc,这里下载了glibc-2.14.tar.xz这个版本,解压到任意目录准备编译
tar xvJf glibc-2.14.tar.xz
在glibc源码目录建立构建目录,并cd进入构建目录
mkdir build cd build
运行configure配置,make && sudo make install
# prefix后是输出的目录 ../configure --prefix=/opt/glibc-2.14 make -j4 sudo make install
参考:
3.2 修改24.0.3 Build Tools下的lib64目录
- 将
android-sdk/build-tools/24.0.3/lib64
下的文件复制到上一步安装完成的/opt/glibc-2.14/lib
目录下 - 修改
android-sdk/build-tools/24.0.3/lib64
文件名(如修改为lib64_bak) - 设置软链接将
android-sdk/build-tools/24.0.3/lib64
指向上一步安装完成的/opt/glibc-2.14/lib
目录
By installing the missing dependency, what I did on one of our RedHat 6 boxes was to compile the glibc v2.14 library locally, then symlink the
/build-tools/24.0.0/lib64 directory to that completed build (this also requires you to move what is currently in that lib64 into the compiled directory prior to linking against the new one). Here are some basic instructions for install. You may want to adjust the version to .14 rather than .16 that these instructions call out.
https://github.com/FezVrasta/ark-server-tools/wiki/Install-of-required-versions-of-glibc-and-gcc-on-RHEL-CentOS
参考:
- If aapt threads crash the plugin waits forever for them to (never) complete
- Install of required versions of glibc and gcc on RHEL CentOS