How to Run Android Applications on Ubuntu

Zdroj:
http://news.softpedia.com/news/How-to-Run-Android-Applications-on-Ubuntu-115152.shtml

une 25th, 2009, 18:04 GMT| By

Android 1.5 Emulator on Ubuntu 9.10 Alpha 2
Enlarge picture

When Google announced and released Android, back in October 2008, everyone knew that it would become the best operating system for mobile devices. Not only is Android open source, but it also comes with a Software Development Kit, which offers the necessary APIs and utilities for developers to easily build powerful applications for Android-powered mobile devices. The following tutorial was created especially for those of you who want to test the Android platform and install various applications, on the popular Ubuntu operating system. OK, so let’s get started… shall we?

Grab the Android SDK from Softpedia and save the file on your home folder.

Editor’s note: The tutorial was rewritten for the new Android 2.0 or later, which provides a graphical user interface to setup a virtual device and the SD card. This makes everything a lot easier. No more command-line madness!

Step 1Installing the requirements

Until the download is over, make sure that you have Java installed and the 32-bit libraries (for the x86_64 users ONLY). If you don’t have Java (or the 32-bit libraries), go to System -> Administration -> Synaptic Package Manager

Review image

…search for openjdk and double-click on the openjdk-6-jre entry…

Review image

…then, search for ia32-libs (ONLY if you are on a x86_64 machine), and double-click on the ia32-libs entry…

Review image

Now, click the „Apply“ button to install the packages. Wait for the packages to be installed and close Synaptic when the process is finished.

Step 2Android Setup

When the Android SDK download is over, right-click on the file and choose the „Extract Here…“ option…

Review image

Enter the extracted folder, then enter the tools folder and double click the android file. Click on the „Run“ button when you will be asked what you want to do, and the Android SDK and AVD Manager interface will appear…

Review image

Go to the „Settings“ section and make sure you check the „Force https://…“ box. Click the „Save & Apply“ button….

Review image

Now go to the „Installed Packages“ section and click the „Update All“ button. A window will appear with all the available updates. Click the „Install Accepted“ button…

Review image

…and wait for the packages to be downloaded and installed. It will take a while if you have a slow bandwidth, so go see a movie or something until it finishes…

Review image

Close the update window when it’s done and you will see all the installed SDKs in the „Installed Packages“ section.

And now, let’s create the virtual device. Go to the „Virtual Device“ section and click the „New“ button. In the new window do the following:

– put a name to the device;
– select a target (Android system);
– put the size for the SD Card;
– add the hardware you want have in the emulator.

It should look something like this…

Review image

Click the „Create AVD“ button when you’re done setting up the virtual device and wait for it to finish. It takes about 1 minute, and you’ll be notified by a pop-up…

Review image

Note: In the above setup, we’ve created a virtual device for Android 2.0.1 with a 2 GB SD card and the following hardware components: SD Card, GPS, Accelerometer, Track-ball and touch-screen.

Now click the „Start“ button, and the „Launch“ button from the next dialog, and the emulator will start…

Review image

Review image

To make things a lot simpler let’s create a desktop shortcut, so you won’t have to open the terminal every time and type some command, in order to start the Android emulator. Therefore, right-click on your desktop and choose the „Create Launcher…“ option…

Review image

In the Create Launcher window, type „Android Emulator“ (without quotes) in the Name field, and paste the below line in the Command field. Optionally, you can also put a nice icon if you click the icon button on the left…

/home/YOURUSERNAME/android-sdk-linux_86/tools/emulator @softpedia

Review image

Note: Please replace YOURUSERNAME and the name of the Android Virtual Device (softpedia in our case) with your USERNAME and the name you gave to the virtual device. DO NOT REMOVE the @ sign.

Step 3Run applications in Android

All you have to do now is double-click that desktop shortcut you’ve just created. The Android emulator will start. Wait for the operating system to load…

Review image

When the Android operating system has loaded, you can install and test applications. If you are used with the Android platform, you already know how to do that, but if this is your first time… follow the next instructions.

Review image
Android 1.1

Review image
Android 1.5

Click the Browser icon, wait for the browser to load and click Menu -> Go to URL. Enter the address from where you can download an Android application with the apk extension. For example, we’ve easily installed Android’s Fortune from Launchpad…

Review image

Review image

Review image

Review image

Review image

Review image

Review image

…all you have to do is follow the on-screen instructions!

Have fun, and do not hesitate to comment if you want to know more about Android, or if you’re stuck somewhere in the tutorial.

Copyright © 2001-2011 Softpedia. Contact/Tip us at

TAGS:

Android | Ubuntu | Emulator | Google | Linux
Read by 210,355 user(s) | Link to this article

MORE RELATED ARTICLES:


First Look: Ultimate Edition 2.2

Linux Mint 7 x64 Released

Elive 1.9.31 Offers Support for Acer Aspire…

R.I.P. Linux 9.2 Has Linux Kernel 2.6.29.5

Available Now: g:Mini 3.0

SHARE THIS TWEET THIS
Subscribe to news Print article Send to friend

User opinions:

Comment #1 by: dirtprof on 26 Jun 2009, 23:07 GMT reply to this comment

Why, in the 2nd screenshot under „step 3“, do the two clocks differ by ~11-12 minutes?

Comment #1.1 by: Marius Nestor on 29 Jun 2009, 09:20 GMT

Hmmm… you’re right… probably because the one on the desktop was not correctly setup, to be in sync with the system clock 🙂

Comment #1.2 by: user on 18 Aug 2010, 22:40 GMT

Slow but works, nice how to, tanx

Comment #2 by: Miles on 30 Jun 2009, 19:08 GMT reply to this comment

Can we use the Android Market from this?

Comment #2.1 by: Marius Nestor on 01 Jul 2009, 09:39 GMT

No, but you can install Android applications from our website, here http://handheld.softpedia.com/deviceSoftware/8

Comment #3 by: phonixor on 30 Jun 2009, 20:58 GMT reply to this comment

….
mmmh there will be other support for it in the future i believe…
it was at UDS… but dont know any details…
cause this emulator takes a long while to startup…
and doesnt have market, or contact sync… (least mine didn’t work :P)

Comment #4 by: patrick on 01 Jul 2009, 01:40 GMT reply to this comment

This is how to run the android EMULATOR, not run android application natively, which canonical has recently demo’d.

Misleading title!

Comment #5 by: Marius Nestor on 01 Jul 2009, 09:05 GMT reply to this comment

For now it is the best solution to TEST any Android application… without messing up your Android-powered phone!

Comment #6 by: Michael on 01 Jul 2009, 13:55 GMT reply to this comment

I am using this behind a proxy, where can I enter the proxy settings? Thanks

Comment #7 by: pjv on 01 Jul 2009, 21:29 GMT reply to this comment

This howto makes it clear to many people how to make good use of Android, without even owning a real phone.

It’s nice to see Android’s Fortune being featured. Many thanks Vadim!

If anybody is interested in contributing ideas or work to Android’s Fortune, please visit the Launchpad webpage of this open source app, as shown above, and jump right in or contact me.

Comment #8 by: Joel on 04 Jul 2009, 14:45 GMT reply to this comment

I really like the style in which this was written, most tutorials rarely ever go in depth into installing the program and just say use „apt-get …“ Thanks, this article was informative and helpful.

Comment #9 by: shabi on 21 Jul 2009, 06:49 GMT reply to this comment

may i know how one can attach his own plugin to andriod.
i mean some tools chain required to build our plugin? if is it so then can you tell me what are the steps..

Comment #10 by: Sofia on 22 Jul 2009, 23:25 GMT reply to this comment

Hi,

I wanted to know if I can open a local HTML file in android ? I believe that the browser cannot open local HTML files for security reasons. But the HTMLViewer can. But I can’t see a HTMLViewer in the android menu.

Any information will be very helpful.

Thanks,
Sofia Tahseen

Comment #10.1 by: Marius Nestor on 23 Jul 2009, 07:47 GMT

Hello Sofia,

The emulator is just like the real thing… you can’t access local files.

Comment #10.2 by: Emon Sarker on 11 Jun 2010, 12:50 GMT

Hi if you put your html file in the sdcard using DDMS then you can access the local file

Comment #11 by: Chris on 17 Aug 2009, 19:08 GMT reply to this comment

Hello, I got to the very last step, the launcher, but then for some reason I cannot open the emulator. I double click the launcher and nothing happens. The comment is correct, I changed the softpedia variable and the dir. Any suggestions?

Comment #11.1 by: Chris on 18 Aug 2009, 18:22 GMT

Nevermind I found out what I was doing wrong there but then I still get something saying that it cannot open because permission is denied.

Comment #12 by: Joseph Schwenker on 10 Sep 2009, 22:59 GMT reply to this comment

When I make the shortcut, it tells me that the directory does not exist when I try to launch the emulator. „Details: Failed to execute child process „/home/joseph/android-sdk-linux_x86-1.5_r2/tools/emulator“ (No such file or directory)“

Comment #12.1 by: Frank Jones on 06 Sep 2010, 00:02 GMT

Make sure you have the ia32-libs installed per instructions above. I had a similar problem until I took this step.

Comment #13 by: joseph on 30 Sep 2009, 18:42 GMT reply to this comment

this article’s tile is highly misleading, as the article doesnot describe how to install apk’s on the andorid as you can’t insatall android market in a legal way. hence all you can do is just run the emulator and nothing else, YOU can not install any apps,,,,…and You can run the apps on window/macs etc…no big deal about running andorid emulator on ubutnut…dont‘ make a fuss about it ! Oh Jesus, it sucks !

Comment #14 by: Shajahan Shaharia on 31 Oct 2009, 22:36 GMT reply to this comment

hi i was wondering how would i remove this if i wanted to?!

Comment #15 by: Marius Nestor on 02 Nov 2009, 10:49 GMT reply to this comment

Hi… Just delete the android-sdk-linux_x86… folder and the desktop shortcut.

Comment #16 by: Durolipons on 15 Nov 2009, 17:33 GMT reply to this comment

Im gettin the same problem “ (No such file or directory). I’m guessing this is because I have a 32 bit system. The file Ive downloaded is android-sdk_r3-linux.tgz. Unziped it is android sdk linux.

Please help.

Comment #17 by: amjad_2020 on 11 Dec 2009, 22:39 GMT reply to this comment

Hi when i do this
./android create avd -n softpedia -t 2
it gave me error :-((
Error: Target id is not valid. Use ‚android list targets‘ to get the target ids

i have ubuntu 9.10

Comment #17.1 by: Marius Nestor on 15 Dec 2009, 08:36 GMT

Android 2.0 has a GUI now to create virtual devices… just execute ./android in the tools folder and setup a new Virtual Device from the interface.

I will rewrite this tutorial as soon as possible!

Comment #17.2 by: Marius Nestor on 15 Dec 2009, 13:25 GMT

On December 15th, the tutorial was rewritten for Android 2.0. No more commands in the terminal. Everything is done with a GUI.

Comment #18 by: Amjad_2020 on 16 Dec 2009, 18:30 GMT reply to this comment

Error: Target id is not valid. Use ‚android list targets‘ to get the target ids

Comment #18.1 by: Marius Nestor on 17 Dec 2009, 19:34 GMT

Use a target… from the drop-down Target list like in this screenshot http://news.softpedia.com/images/extra/LINUX/large/androidubuntu-large_024.jpg

Be aware that the guide has been changed, so you don’t have to use a terminal anymore!

Comment #19 by: Louis Tim Latrsen on 29 Dec 2009, 16:58 GMT reply to this comment

Thanks a lot for the great tutorial!

Comment #20 by: Joseph Schwenker on 07 Jan 2010, 16:40 GMT reply to this comment

How long is the OS supposed to take to boot up? Mine takes over a minute, maybe over two. Also, Android itself is quite laggy. Is there any way to make it faster?

Comment #20.1 by: Marius Nestor on 08 Jan 2010, 10:31 GMT

Yes, it takes a few minutes to boot. I don’t know if there is a way to make it boot faster. Probably a faster computer?

Comment #21 by: Tim on 17 Jan 2010, 15:34 GMT reply to this comment

Great tutorial. You might consider adding „click Save & Apply“ after the instructions to click force HTTPS.

Comment #22 by: DarkWizard on 09 Feb 2010, 11:18 GMT reply to this comment

Good job guys.
Only one thing, can you explain how to use our applications (i mean i am triying to develop an application).

Thank you.

Comment #22.1 by: Marius Nestor on 09 Feb 2010, 11:23 GMT

Thanks! That’s why I created this tutorial… for Android application developers to test their stuff…

All you have to do is to upload the apk file somewhere on a server (NOT file sharing ones…. I don’t think those’ll work) and install it like in the tutorial 🙂

Comment #23 by: youshi patel on 23 Feb 2010, 19:41 GMT reply to this comment

excellent tutorial. thanks for the posting. i got everything working on ubuntu 9.10

Comment #24 by: helpyhelp on 25 Feb 2010, 05:08 GMT reply to this comment

Open::
System
Preferences
Network Connections *Edit connections to accept mac address for admin

Open::
Applications
Accessories
Terminal
Run::

sudo apt-get update

Open::

System
Administration
Synaptic Package Manager

Search::
openjdk-6-jre *Upgrade and Apply File

Transfer over Android SDK File to UBUNTU Home Folder

Comment #25 by: dinesh on 13 Mar 2010, 01:48 GMT reply to this comment

This was great tutorial. I could easily start android non my ubuntu using it

Comment #26 by: Douglas on 09 May 2010, 18:15 GMT reply to this comment

No Target is available from the dropdown. Am I missing something?

Ubuntu 8.10
sun-java6-sdk

Thanks for this Tutorial!

Comment #27 by: Senthil on 28 May 2010, 06:01 GMT reply to this comment

I am getting some chinese language when i type any msg or if use the browser.How do I change it

Comment #27.1 by: Bit Hacker on 09 Jun 2010, 13:30 GMT

Goto Settings of the browser and Select Text Coding. From there change it to GBR or whatever language you want.

Comment #28 by: Gary on 03 Jun 2010, 21:37 GMT reply to this comment

My ‚phone‘ never becomes a phone 🙁

It stays looking like the images before step 3.

What am I missing?

I guess things have moved on somewhat because I have version 2.2 and API level 8.

Still no phone though.

Comment #29 by: Alyssa on 05 Jun 2010, 17:40 GMT reply to this comment

hi all. nice tutorial but i have problem, it’s almost 2 hours that i’m stuck in Android boot process.
http://i1-news.softpedia-static.com/images/extra/LINUX/small/androidubuntu-small_026.png
can you help me with this? thanks

Comment #29.1 by: Alex Little on 27 Aug 2010, 13:14 GMT

I installed the emulator yesterday (on Ubuntu 10.04) and I have the same problem with it sticking on the ‚android‘ text as your image shows. Did you get this resolved? I wondered if it could be because I’m using Sun JDK, not OpenJDK – I know that shouldn’t make any difference, but I can’t think of any other issue.

Comment #30 by: John Wesley Harding on 06 Jun 2010, 05:14 GMT reply to this comment

when i tap on the apk file with browser it’s only downloaded the file instead of installation prompt like the screenshot said. what did i miss?

Comment #31 by: Martin on 09 Jul 2010, 20:15 GMT reply to this comment

I cant create a Virtual Device with a SD Card, i give an Value (e.g. 2048) and ‚insert‘ Hardware Support SD-Card. But i become always a error message. For SD Car suport you have least 9 MB…
But i have more than 9 MB, whats wrong ?

Comment #32 by: Mohanan on 14 Jul 2010, 17:31 GMT reply to this comment

Excellent! I followed the instructions to the letter and created a virtual machine for FroYo on my Linux machine running Ubuntu 10.04.
I too found „for SD card support you need more than 9 MB) even after giving 1024.
Thanks a lot
Warm Regards
–MohananPG

Comment #33 by: wranglers on 25 Jul 2010, 23:12 GMT reply to this comment

Got as far as creating a desktop icon then everything went to hell in a handbasket. I don’t know what my USERNAME is. As far as I know I don’t have one. I just boot the computer up and it boots into Linux. I have a password but that’s all I know. I also don’t remember what I called my device from the virtual device section. I think I called it milestone but can’t be sure. What now?

Comment #33.1 by: Tarcas on 28 Aug 2010, 17:18 GMT

To find your user name, open a terminal and enter the command „whoami“
It will return your user name.

Comment #34 by: Hunter on 27 Jul 2010, 09:54 GMT reply to this comment

I can’t seem to get the data part to work. Can’t access the browser because it says „No- Service“. Help?… Thanks.

Comment #35 by: jojo921 on 21 Aug 2010, 14:40 GMT reply to this comment

I could not get all the files to install in step 1 so I did not have the sdk to open and run. I am using the latest version of ubuntu. what’s up?

Comment #36 by: efittery on 29 Aug 2010, 22:09 GMT reply to this comment

I suggest a native English speaker read and correct some things in this document:

As an example:

Until the download is over, make sure that you have Java installed and the 32-bit libraries (for the x86_64 users ONLY).

??? what does „Until the download is over“ mean? Maybe „Until“ should be „After“ or maybe „Before“. There are other places in the tutorial that have similar problems.

Nice stuff… Just needs some English grammar tweaks…

Comment #37 by: cutiyar on 02 Nov 2010, 15:56 GMT reply to this comment

i cant found the ia32-libs file from synaptic manager, my ubuntu is on 32 bit .

Comment #37.1 by: Helper on 03 Nov 2010, 16:48 GMT

Please read the instructions:

„…then, search for ia32-libs (ONLY if you are on a x86_64 machine), and double-click on the ia32-libs entry…“

If you are using a 32 bit machine, then you are not running a 64 bit machine. You don’t need ia32-libs.

Comment #38 by: Satyam on 24 Dec 2010, 04:44 GMT reply to this comment

I have install the android on my ubuntu.
Now I want to know that how can I upload my code files and where is to upload these files.

Comment #39 by: x34460 on 04 Jan 2011, 09:42 GMT reply to this comment

followed tutorial and the emulator was up and running however android will not browse the internet. host computer’s only connection to web is wifi. is this a problem? emulator shows 2 to 3 bars for signal.

help?

Comment #40 by: Mahdiar on 05 Jan 2011, 19:30 GMT reply to this comment

I followed the instruction but in the virtual device part I can’t select the target ! what should I do now . Please Help !

Comment #41 by: Mike on 18 Jan 2011, 08:51 GMT reply to this comment

Very good program and directions. I had to follow them very carefully, though… which is the way it should be.
I could not close the browser, though. I used CTRL-X finally, and forced it closed.
Working on Ubuntu 10.x, kinda slow, but it works. Thanks!!!

Comment #42 by: ap1285 on 07 Feb 2011, 06:41 GMT reply to this comment

Totally Misleading Title of the post….. it should be „Setting up Android SDK / Emulator on ubuntu“

Comment #42.1 by: someone on 22 Jul 2011, 04:48 GMT

Yes it should. Bad on them.

Comment #43 by: vandermi on 26 Feb 2011, 13:27 GMT reply to this comment

Very good !! This is the best android tutorial for linux.
Congratulations

Comment #44 by: chhabrakadabra on 06 May 2011, 05:58 GMT reply to this comment

I had a problem with the emulator not running. It said „/android-sdk-linux_86/tools/emulator“ didn’t exist, when it clearly did. Thanks to your post, I knew that installing ia32-libs was the package I needed to install to get this running. Thank you.

Comment #45 by: nidhi on 11 May 2011, 17:57 GMT reply to this comment

thank u very much
i hav just bought a samsung galaxy ace
so wanted to test d apps

Comment #46 by: ruler501 on 15 May 2011, 04:55 GMT reply to this comment

How do you upload python files to the emulator?

Comment #47 by: alfaromeo on 17 Jun 2011, 17:21 GMT reply to this comment

I’ll tried it and success, but i’ve problem too… i cant run it again…. why? thanks….

Comment #48 by: cc5179 on 18 Jun 2011, 20:02 GMT reply to this comment

Where did you get the Android SDK?
I did what it said to do and nothing was in my desktop.

Comment #49 by: asker on 30 Jun 2011, 05:10 GMT reply to this comment

what could possibly be wrong if the launch options dialog (the window that pops up after hitting the start button) doesn’t show up? thanks.

Comment #50 by: someone on 22 Jul 2011, 04:47 GMT reply to this comment

The title says ‚how to run android applications on ubuntu‘ but it shoud say ‚How to run an android emulator‘. This isn’t running any applications on ubuntu. It’s running an emulator on ubuntu, namely the andoid sdk, and running andoid applications on the emulator. Sorry, not the same thing.