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
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.
I met the same problems and google it. You can try the following suggestions:
- If you are in 64-bit environment, try: sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev.
- Update the latest android sdk tools and do not move the zipalign binary to any other folder. It solve my problem.
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