157

I'm using Ubuntu Gnome 14.04, and I have Java 8 installed (both the JDK and the JRE).

When I was installing Android Studio everything worked, but a message appeared saying:

Unable to run mksdcard SDK tool

How can I install Android Studio correctly, or how do I fix this ?

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
Carlos Carrizales
  • 2,340
  • 3
  • 18
  • 24

10 Answers10

270

Presuming that you are running the 64bit Ubuntu, the fix suggested for "Issue 82711" should solve your problem.

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Update: For Ubuntu 15.10 & 16.04 sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6

Rajesh
  • 15,724
  • 7
  • 46
  • 95
  • so, my problem was from some libraries of 32bits, pff, thank you! – Carlos Carrizales Mar 04 '15 at 06:06
  • 55
    The only required part is the last bit i.e. lib32stdc++6 – warsong Mar 16 '15 at 16:16
  • 10
    @warsong, I had the same issue on Debian Jessie 64bits. installing `lib32stdc++6` solved my problem too. – Franklin Piat Apr 03 '15 at 20:17
  • 4
    I cant do this. _Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: lib32stdc++6 : Depends: lib32gcc1 (>= 1:4.1.1) but it is not going to be installed E: Unable to correct problems, you have held broken packages._ – Tomasz Mularczyk Apr 15 '15 at 21:02
  • 1
    @Tomek Try `sudo apt-get install -f` to fix broken dependencies. – Rajesh Apr 16 '15 at 05:30
  • I already solved it and I'm pretty sure answer on this site helped [link](http://askubuntu.com/questions/73491/no-such-file-or-directory-for-existing-executable/165536#165536) . However I'm not so sure because I was trying to fix it with many commands ;) – Tomasz Mularczyk Apr 16 '15 at 11:01
  • @Rajesh lib32stdc++6 isn't installing even with the -f flag. – amar Jun 02 '15 at 10:44
  • 4
    sudo apt-get install lib32bz2-1.0 returns error: E: Unable to locate package lib32bz2-1.0 E: Couldn't find any package by regex 'lib32bz2-1.0' – Muhamed Huseinbašić Aug 19 '15 at 07:59
  • I installed all the required packages and even after reboot I got the “Unable to run mksdcard SDK tool” error :( what am I doing wrong? I am using Xubuntu 14.04 64 bit (3.16.0-49-generic GNU/Linux) – Le 'nton Sep 15 '15 at 21:10
  • 7
    for those who had errors with lib32bz2-1.0. you just run without it: sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6 – Sanf0rd Oct 28 '15 at 18:13
  • Year, This is very userful for me! – wangzhengyi Nov 03 '15 at 12:11
  • unfortunately, the error still isn't solved for me. Linux Mint 17.2 with installed 32-bit libraries. – luckyhandler Nov 13 '15 at 12:49
  • For fedora `sudo yum install compat-libstdc++-296.i686 compat-libstdc++-33.i686 ncurses-libs.i686` – JorgeGarza Jan 13 '16 at 03:56
  • In ubuntu 16.04 "Unable to locate package lib32bz2-1.0". what should I do? – Dipu May 28 '16 at 18:31
  • 1
    @dipu http://askubuntu.com/a/637132/513530 - `libbz2-1.0:i386` – zapl Jul 19 '16 at 16:47
  • As an info,the same is provided in the android tech help link given below, http://tools.android.com/tech-docs/linux-32-bit-libraries – jrh Jul 21 '16 at 04:35
81

@warsong is right. Installing only lib32stdc++6 solved the problem.

For next uses I rewrite @warsongs comment in answer area.

sudo apt-get install lib32stdc++6

Update :

For Ubuntu 15.04,15.10,16.04 LTS & Debian 8

Sayem
  • 4,891
  • 3
  • 28
  • 43
  • 2
    I found that I did need the `lib32z1` package as well after I got this error while attempting to compile: `aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory` – kostmo May 25 '15 at 06:01
  • what is your Ubuntu version? I tested it only in 15.04 LTS – Sayem May 25 '15 at 06:18
  • I also tested in Ubuntu 15.04 (which is not LTS, btw; 14.04 is LTS). – kostmo May 25 '15 at 09:31
  • I am on Freya and just need only lib32stdc++6 to solve the problem – qmn1711 Jun 26 '15 at 19:20
  • 1
    But need full libs for running gradle in Android Studio :(. "sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6" – qmn1711 Jun 27 '15 at 02:14
  • 2
    The scope of the problem is only about mksdcard failure, unless it is specified to fix everything, so this is considered as a right answer. – neferpitou Jul 27 '15 at 14:28
  • this was run for me. Thanks!!!! – Akshay Pethani Feb 12 '16 at 04:12
  • 14.04 LTS confirmed working with this library only. – Franklin Yu Feb 26 '16 at 05:01
  • I have got `lib32ncurses5` installed before so I can't tell its necessity, but I got through the `mksdcard` problem without any help of package `lib32z1` or `lib32bz2-1.0`. – Franklin Yu Feb 26 '16 at 06:43
  • I install only this lib and get this error http://stackoverflow.com/questions/18041769/error-cannot-run-aapt I think @Rajesh solution is the best – ViT-Vetal- Jun 30 '16 at 13:10
11

For Fedora (tested for Fedora 23/24) run

dnf install compat-libstdc++-296 compat-libstdc++-33 glibc libgcc nss-softokn-freebl libstdc++ ncurses-libs zlib-devel.i686 ncurses-devel.i686 ant
Timo Bähr
  • 1,826
  • 2
  • 22
  • 26
  • In the meantime developer.android.com contains a command for this. Try `dnf install zlib.i686 ncurses-libs.i686 bzip2-libs.i686`. This SHOULD be all. Have not tried it yet. – Timo Bähr Oct 19 '16 at 18:45
  • The step from developer.android.com is not working on Fedora 24. I have tested `dnf install zlib.i686 ncurses-libs.i686 bzip2-libs.i686`. This will install `bzip2-libs, glibc, ncurses-libs, nss-softokn-freebl, zlib`. After installation still the `mksdcard` error appears. – Timo Bähr Nov 17 '16 at 07:33
4

I understand the question is regarding UBUNTU, but I had similar problem in Debian Jessie 64bit and warsongs suggestion worked for it also.
When I ran studio.sh android studio would start, but when I tried to configure the android SDK I got the error
Unable to run mksdcard SDK tool
WHen I tried
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
Got error
E: Package 'lib32bz2-1.0' has no installation candidate
So took warsongs suggestion and only tried to install lib32stdc++6.
sudo apt-get install lib32stdc++6
After this was able to add the Android SDK into Android Studio.

drlolly
  • 157
  • 2
  • 6
  • Confirmed; same problem, this represents a fix. Me: Debian 64-bit, running Stretch (testing). Thank you. – iokevins Nov 19 '15 at 14:29
3

Checkout this page

If you are running a 64-bit distribution on your development machine, you need to install additional packages first. For Ubuntu 13.10 (Saucy Salamander) and above, install the libncurses5:i386, libstdc++6:i386, and zlib1g:i386 packages using apt-get:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
sudoz
  • 3,275
  • 1
  • 21
  • 19
2

The Problem is caused by mksdcard not being installed correctly.

if you are running 64 bit, do this to fix the mksdcard problem.

    sudo dpkg --add-architecture amd64
    sudo apt-get update
    sudo apt-get install libncurses5:amd64 libstdc++6:amd64 zlib1g:amd64

and 32 bit:

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

In SDK 6.0, the error message is different but means the same thing.

    Unable to run mksdcard
Kyler Chin
  • 188
  • 12
2

None of these options worked for me on Ubuntu 12.10 (yeah, I need to upgrade). However, I found an easy solution. Download the source from here: https://github.com/miracle2k/android-platform_sdk/blob/master/emulator/mksdcard/mksdcard.c. Then simply compile with "gcc mksdcard.c -o mksdcard". Backup mksdcard in the SDK tools subfolder and replace with the newly compiled one. Android Studio will now be happy with your SDK.

mjancola
  • 429
  • 1
  • 4
  • 7
0

For Linux Mint run

sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0 lib32stdc++6
Bit-Man
  • 516
  • 4
  • 17
0

If you run sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0 lib32stdc++6 and got a message like: "The following packages have unmet dependencies: lib32stdc++6 : Depends: lib32gcc1 (>= 1:4.1.1)".

You can do something like this tut: https://askubuntu.com/questions/671791/lib32stdc6-package-depends-on-gcc-base-but-my-installed-version-is-newer

Community
  • 1
  • 1
anhnv
  • 42
  • 3
0

This issue arises when your 64 bit os tries to install the Android SDK which in turns tries to install some 32 bit binaries and thus is the issue of compatibility.

Open an additional terminal and type

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 

would help to install all the required binaries. After this, start the afresh the Android SDK installation process.

Selvaperumal
  • 667
  • 5
  • 11