53

I installed Eclipse, openjdk6 and downloaded and extracted the sdk manager file.

Now, When I created an Android project I got the following error:

2012-06-06 18:44:40 - contactManager] /home/catia/android-sdks/platform-tools/aapt: 
error while loading shared libraries: libz.so.1: cannot open shared object file: 
No such file or directory

And this one when I tried to create an AVD Manager:

[2012-06-06 19:00:18 - SDK Manager] /home/catia/android-sdks/tools/mksdcard: error 
while loading shared libraries: libstdc++.so.6: cannot open shared object file: No 
such file or directory 
[2012-06-06 19:00:18 - SDK Manager] Failed to create the SD card.
[2012-06-06 19:00:18 - SDK Manager] Failed to create sdcard in the AVD folder.
  • sudo apt-get install libstdc++6-4.6-dev [or search on synaptic with libstdc++ ]. and sudo apt-get install zlib1g-dev – shantanu Jun 6 '12 at 18:52
  • 3
    @shantanu The problem is not that the header files (-dev packages) are missing, but that the Android SDK needs the 32-bit versions of the libraries. Header files are only needed for building software that relies on a library, not for running pre-built software. – Eliah Kagan Jun 6 '12 at 19:25
46

This problem is occurring because the Android SDK is compiled for a 32-bit GNU/Linux system, and your Ubuntu system is a 64-bit GNU/Linux system. The solution should be easy (since Ubuntu fully supports running 32-bit programs on a 64-bit OS)--just install the 32-bit versions of the libraries it needs.

The simplest and easiest way to do this is to install the 32-bit versions of all the most commonly used libraries, by installing the ia32-libs Install ia32-libs package. You can do this in the Software Center or in the Terminal with:

sudo apt-get update
sudo apt-get install ia32-libs

Originally ia32-libs was provided because Ubuntu, in its default configuration, didn't support installing 32-bit Ubuntu packages on a 64-bit system. Now that this is fully supported by default, the ia32-libs package just causes the same 32-bit packages to be installed on your 64-bit system that would be installed on a minimal 32-bit system. (So for anyone who is worried this might not work now that multarch is supported by default: it still works.)

Source: Android/Eclipse Installation on Ubuntu 11.04 - aapt and adb not working properly
See also: Eclipse Android Plugin — libncurses.so.5

| improve this answer | |
  • 11
    This no longer appears to be a solution for Ubuntu 13.10. – Sahas Katta Oct 20 '13 at 23:04
  • 10
    @SahasKatta this works askubuntu.com/a/165536/1599 – phunehehe Oct 27 '13 at 7:51
  • Read @SahasKatta comment before console shot. – danihp Jun 22 '14 at 12:43
  • 3
    Ubuntu 13.10+ the ia32-libs have been replaced by lib32z1, lib32ncurses5, and lib32bz2-1.0 (mesage provided when you try to install ia32-libs). lib32stdc++6 is not included in this list but is also required. – RBI Jun 29 '14 at 16:13
  • 3
    This answer lead me to what worked for me: "sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0" – cjstehno Sep 20 '14 at 1:00
55

If you are using Debian Jessie (or Ubuntu 13.10+), try

sudo apt-get install lib32stdc++6

| improve this answer | |
  • It work well for ubuntu 13.10 64 bit – Tamil Selvan C Nov 17 '13 at 15:12
  • Just solved the same problem for me on Linux Mint 16 RC. – Trevor Nov 21 '13 at 22:35
  • 3
    worked for me on brand-new Ubuntu 14.04. thanks a lot! – talha06 Apr 18 '14 at 1:50
36

This thread was the fix for me.

Specifically, installing this package:

sudo apt-get install lib32z1 lib32z1-dev
| improve this answer | |
  • 1
    None of the answers, except this one, worked for me. Thanks :) – codeMan Jan 2 '14 at 17:00
  • I'm getting a lot of rep for this answer ... thanks ... somehow user 'Squeezle' changed my answer so what is above is not my original post. -1 to the site for allowing my response to be changed by whomever, but +1 to squeezle for posting what looks like a popular answer. – ether_joe Jul 25 '14 at 18:23
  • Only one that worked for me on Ubuntu 14.04 64bit. Thank you! – TJ Biddle Mar 18 '15 at 21:57
  • Works perfectly on Debian 8.1.0. I already had lib32stdc++6 so I knew this wasn't the issue. Thanks again! – woahguy Sep 6 '15 at 11:13
16

I just ran into this on Ubuntu 14.04 64-bit. My solution was:

sudo apt-get install -y libc6:i386 libgcc1:i386 libstdc++6:i386 libz1:i386

Based on the shared libraries required for the aapt tool:

$ readelf -d android-sdk-linux/build-tools/20.0.0/aapt | grep -i shared
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
| improve this answer | |
  • 3
    Thanks. This worked for me (Ubuntu 14.04 x64). The others donn't. – Juanin Jul 28 '14 at 20:10
7

This works for me: aptitude install lib32stdc++6

| improve this answer | |
  • This also eliminated a ton of R related errors for me. – Akiva Nov 8 '15 at 10:09
2
sudo apt-get install lib32z1

This worked for me.

Go to synaptic --> Search for lib32z1 --> select both runtime and development Apply and u r done.

| improve this answer | |
2

For Ubuntu >= 13.04 instead of ia32-libs you need libgl1-mesa-dev:i386

sudo apt-get install libgl1-mesa-dev:i386

Check Complete Installation Guide for Android SDK / ADT Bundle on Ubuntu

| improve this answer | |
2

For Ubuntu 15.04, the following was necessary:

sudo apt-get install lib32stdc++6 lib32z1
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.