Wednesday 19 February 2014

Running 32-bit eclipse ADT in 64-bit ubuntu 12.04

Here are the steps to safely install Android SDK on ubuntu 12.04 and avoid any errors.
1. Install eclipse Android SDK on 64-bit linux as directed                   at https://developer.android.com/sdk/installing/index.html.
Now eclipse will run fine but when we try to launch AVD emulator it may throw an error :
Cannot run program “ xx/sdk//tools/emulator”: java.io.IOException: error=2, No such file or directory
Info :
This is very common on 64-bit linux with a very simple solution.
mentioned at https://wiki.debian.org/Multiarch/HOWTO
solution according to them is :

Installing Android SDK compat libraries


Some users using the Android SDK might encounter problems when trying to run build-tools or platform-tools on amd64 bit platform. As replacement for ia32-libs, users should be fine just installing the following libraries:
dpkg --add-architecture i386
aptitude update
aptitude install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
 But this is not the solution for ubuntu 12.04 users
 because "--add-architecture" is not supported with the dpkg version (1.16.1.2 (amd64)) supplied with ubuntu 12.04. Thus we have to do the same thing in another way. Here is how :
Solution :
make sure the only file present in /etc/dpkg/dpkg.cfg.d/ is "multiarch"
ls /etc/dpkg/dpkg.cfg.d/
if output is multiarch, execute the following commands as it is else replace "multiarch" with the name of file present in that directory.
sudo sh -c "echo 'foreign-architecture i386' > /etc/dpkg/dpkg.cfg.d/multiarch"
The above commands will add i386 architecture (alternate command to "dpkg --add-architecture i386") . The rest commands are the same (you can use aptitude instead of apt-get if you have aptitude installed)

sudo apt-get update
sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 
 Run the above commands and you're done! The emulator should work fine now.

Tried On : Ubuntu 12.04 + eclipse+ADT Build : v22.3.0-887826
May also work on : Ubuntu 12.04 and later versions , but note that for versions later than 12.04 , the first official solution mentioned in this post is easier.

No comments:

Post a Comment

Featured Post

PHP EmailMessage class for extracting attachments

Hi, recently I had to create a php program which fetches emails with attachments (including inline). I searched a lot and succeeded with h...