zipalign: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

旧时模样 提交于 2019-12-05 03:55:14

问题


I am trying to build android app. When I run the zip align tool to optimize the APK, I get this error message:

zipalign: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

I tried to install libc++

sudo aptitude install libc++

it says: Couldn't find package "libc+".

Snapshot of my terminal


回答1:


If your system is 64-bits, there should be a folder lib64 on the path of

 [android-path]/build-tools/[version]/

The files in lib64 are

[ec2-user 25.0.2]$ ll lib64/
total 51628
-rwxrwxrwx 1 ec2-user ec2-user 30712616 Dec 23 07:22 libLLVM.so
-rwxrwxrwx 1 ec2-user ec2-user   482522 Dec 23 07:22 libbcc.so
-rwxrwxrwx 1 ec2-user ec2-user   433914 Dec 23 07:22 libbcinfo.so
-rwxrwxrwx 1 ec2-user ec2-user  1211614 Dec 23 07:22 libc++.so
-rwxrwxrwx 1 ec2-user ec2-user 20019608 Dec 23 07:22 libclang.so

Just copy the folder lib64 and zipalign program together to the destination path, and you can run the zipalign correctly.

It worked for me. I guess the zipalign has a dependency on the files in lib64 folder.




回答2:


I met the same problems and google it. You can try the following suggestions:

  1. If you are in 64-bit environment, try: sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev.
  2. Update the latest android sdk tools and do not move the zipalign binary to any other folder. It solve my problem.



回答3:


I had the exact same problem and it was probably because I moved the zipalign binary from <android-path>/build-tools/23.0.3 to <android-path>/tools.

The solution is to add the build-tools/23.0.3 dir to your path:

export PATH=${PATH}:<android-path>/build-tools/23.0.3


来源:https://stackoverflow.com/questions/35336697/zipalign-error-while-loading-shared-libraries-libc-so-cannot-open-shared-ob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!