Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

Snapshot of my terminal

like image 630
SSS Avatar asked Feb 06 '26 16:02

SSS


2 Answers

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.

like image 67
liauau Avatar answered Feb 09 '26 08:02

liauau


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.
like image 26
Marvin Wang Avatar answered Feb 09 '26 10:02

Marvin Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!