使用aapt解析apk信息报错“cannot execute binary file”

来源:互联网 发布:破解八零网络验证 编辑:程序博客网 时间:2024/05/22 13:49

    写了个工具类去解析APK包读取里面的信息,在window是环境测试都ok,但是部署到服务器(CentOS)就报错“cannot execute binary file”。

    可能的解决方案:

1、如果是没有执行权限,用命令修改即可:chmod +x aapt

2、可能是编译环境不同造成的:请检查是不是因为 32位 64位操作系统导致或者是amd or intel问题导致;

3、如果还报如下错误

aapt: /lib/libz.so.1: no version information available (required by aapt)

解决如下:

查了一下,服务器上的libz版本太旧了(libz.so.1.2.3)导致的,下载一个新版本(zlib-1.2.7.tar.gz)即可。

a、tar zxvf zlib-1.2.7.tar.gz

b、./configure

c、make

d、make install 【确保用root用户,否则会提示Permission denied】

e、链接老版本 : ln -s /usr/local/lib/libz.so.1 /lib/libz.so.1【可能需要先删除原来的软连接】

4、如果还报如下错误

“error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64...”

换成32位的包,重新安装即可。【如果是64位机器的话,执行 export CFLAGS=-m32 ,然后在按步骤3即可

5、如果上面的办法都不行:The solution that I found for this issue is to download the android sdk for linux,install it, and then grab the aapt file from the platform-tools folder and copy it over the aapt file in lib/android/bin.


参考文章:

http://forums.adobe.com/thread/934859

http://hi.baidu.com/whosafe/item/168890359c7fcc3a2f0f8179

http://www.bumao.com/

http://blog.csdn.net/hitlion2008/article/details/7451940#

http://7dot9.com/2012/12/centos-64%E4%BD%8D%E6%9C%BA%E5%99%A8%E9%85%8D%E7%BD%AEandroid-sdk%E5%92%8Cndk%E7%8E%AF%E5%A2%83/

原创粉丝点击