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.
CJBS
  • 181
csbl
  • 691
  • sudo apt-get install libstdc++6-4.6-dev [or search on synaptic with libstdc++ ]. and sudo apt-get install zlib1g-dev – shantanu Jun 06 '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 06 '12 at 19:25

8 Answers8

55

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

sudo apt-get install lib32stdc++6

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

Eliah Kagan
  • 117,780
36

This thread was the fix for me.

Specifically, installing this package:

sudo apt-get install lib32z1 lib32z1-dev
Squeezle
  • 3
  • 2
ether_joe
  • 1,053
  • 9
  • 14
  • 1
    None of the answers, except this one, worked for me. Thanks :) – codeMan Jan 02 '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 06 '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]
bmaupin
  • 4,930
7

This works for me: aptitude install lib32stdc++6

Eliah Kagan
  • 117,780
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.

Tamil Selvan C
  • 439
  • 2
  • 5
  • 19
Raj
  • 145
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

raghavsood33
  • 131
  • 4
2

For Ubuntu 15.04, the following was necessary:

sudo apt-get install lib32stdc++6 lib32z1
Six
  • 832
  • 7
  • 7