no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | run_android_apps_on_ubuntu_desktop [2018/05/27 16:10] (current) – external edit (unknown user) | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Run Android Apps on Ubuntu Desktop ====== | ||
+ | **Android**, | ||
+ | |||
+ | ====== Running Android using Qemu ====== | ||
+ | |||
+ | For reasons explained in the [[#FAQ]] below, running Android in an emulator is the most straightforward way. One of the most often used Open Source emulator is [[http:// | ||
+ | |||
+ | ===== Installing Qemu ===== | ||
+ | |||
+ | On Debian/ | ||
+ | |||
+ | sudo apt-get install qemu-system-x86 qemu-kvm qemu-utils | ||
+ | |||
+ | On other Linuxes there should be similar commands and similar packages. | ||
+ | |||
+ | A word regarding // | ||
+ | |||
+ | ===== Getting Android ===== | ||
+ | |||
+ | There' | ||
+ | |||
+ | ===== Test Run ===== | ||
+ | |||
+ | Let's do a test run to see wether and how things work: | ||
+ | |||
+ | qemu-system-i386 -enable-kvm -m 1024 -soundhw es1370 \ | ||
+ | -net nic -net user -cdrom / | ||
+ | |||
+ | This is sufficient to boot the emulated device. //-m 1024// gives the device a 1024\_MiB of RAM. 512\_MiB are sufficient for booting, too, but then things become unreliable at setup already. | ||
+ | |||
+ | * At the bootloader screen, just hit Enter (or wait 60 seconds). | ||
+ | * Clicking into the emulator window will catch the mouse inside the emulated device, then you can operate there. To escape, press and release //ctrl// and //alt// on the PC keyboard at the same time. | ||
+ | * When asked to enter a SIM card, click //Skip// in the lower right corner. | ||
+ | * When asked to connect to WiFi, skip as well. Network connections will work anyways. | ||
+ | * When entering text or passwords, be aware that your keyboard has the US-english layout, not the layout of the operating system qemu is running in. | ||
+ | * Don't pause too long, once Android enters sleep mode you can't escape from that. It's a good idea to set sleep to 30 minutes in //Settings -> Display -> Sleep// after finishing setup. | ||
+ | * To stop Android, close the emulator window. This is like removing the battery from a running phone, but it works. | ||
+ | |||
+ | Can you finish setup, start up the browser and surf around the web? Excellent, test passed! | ||
+ | |||
+ | //A note about privacy//: if you care about your privacy, be aware that whatever you enter, do or upload, will be forwarded to Google. Googles business is to collect and analyse such data, similar to NSA. You can skip connecting to your Google account, but then you can't install applications. That said, there is no connection between the host PC and the emulated Android device, they don't even share the same IP address. So, if you create a new Google account from within the emulated device, your stuff is pretty safe. Later we'll install Android onto an emulated hard drive, so it's even possible to use different hard drives for distinct identities, making it impossible for Google to draw a connection between your various accounts. Unless you exploit that connection yourself by entering the same credentials or by using the same account, of course. | ||
+ | |||
+ | ===== Creating a Hard Disk ===== | ||
+ | |||
+ | To remove the need to start over each time Android is launched, we need some permanent storage device: an emulated hard disk. Creating such a disk is rather simple: | ||
+ | |||
+ | qemu-img create -f qcow2 android.img 2G | ||
+ | |||
+ | Yupp, that's just two Gibibytes. Android its self will need about 800\_MiB, the remaining space is for apps. You need more only if you want to store larger amounts of data on the emulated device, like picture or music collections. | ||
+ | |||
+ | ===== Installation to Hard Disk ===== | ||
+ | |||
+ | The obvious first step for an installation is to run Android with both, the CD-ROM and the hard disk mounted: | ||
+ | |||
+ | qemu-system-i386 -enable-kvm -m 1024 -soundhw es1370 \ | ||
+ | -net nic -net user -cdrom / | ||
+ | -hda / | ||
+ | |||
+ | At the boot screen, choose // | ||
+ | |||
+ | Operating all these installation tools with their poor-man' | ||
+ | |||
+ | If the partition chooser lists //sda1//, you can skip creating a partition, there is already one. If the first entry reads //sda// (without number), you have to create a partition. Without partition we have no partition table, so we can't mark the disk as bootable. | ||
+ | |||
+ | Creating a partition: | ||
+ | |||
+ | * Choose // | ||
+ | * Don't use GPT. | ||
+ | * You enter //cfdisk//. Choose //[New]//. | ||
+ | * Hit '' | ||
+ | * Choose // | ||
+ | * Choose // | ||
+ | * Choose //[Quit]//, you're done with partitioning. | ||
+ | |||
+ | The partition chooser should now list //sda1//, with number. This is the volume we want to install Android onto. | ||
+ | |||
+ | * Choose //sda1//. | ||
+ | * Format to //ext4// (or //ext3//, if ext4 isn't available). | ||
+ | * Confirm. | ||
+ | * Install GRUB (else there' | ||
+ | * Skip installing EFI GRUB2. | ||
+ | * Do not install ///system// as read-write. | ||
+ | |||
+ | Just a few seconds later, depending on your physical hard drive speed, the installer will offer to run Android or reboot. Instead of doing either, close the Qemu window. You're ready to run Android the regular way already. | ||
+ | |||
+ | In case you messed up somewhere along the way, simply close the Qemu window and start over. You didn't write data so far, so you can't loose any. | ||
+ | |||
+ | |||
+ | ===== Regular Runs ===== | ||
+ | |||
+ | From now on we have a installed device, the distribution CD-ROM is obsolete. Accordingly there' | ||
+ | |||
+ | qemu-system-i386 -enable-kvm -m 1024 -soundhw es1370 \ | ||
+ | -net nic -net user -hda / | ||
+ | |||
+ | On the first run after an installation you'll have to go through setup again, and it's a bit more lengthy now. Still it's a good idea to do it carefully this time, it's the last time it has to be done. | ||
+ | |||
+ | ====== Tips & Tweaks ====== | ||
+ | |||
+ | Here are a few commonly done procedures in loose order. | ||
+ | |||
+ | ===== Adjust Keyboard Layout ===== | ||
+ | |||
+ | In Android, go to //Settings -> Language & Input// and look at //Physical keyboard//. This is the input method with which Qemu forwards keystrokes to Android. | ||
+ | |||
+ | Changing the keyboard layout is a bit complicated: | ||
+ | |||
+ | //Note//: there' | ||
+ | |||
+ | ===== Getting Screen Size Right ===== | ||
+ | |||
+ | One of these nagging annoyances is, that many, many apps insist on running in portrait mode; which means the screen is higher than wide. | ||
+ | |||
+ | The situation is a bit unfortunate, | ||
+ | |||
+ | The solution is to ask Grub, the bootloader, to set a screen size. Thank you to Thierry Delprat at [[http:// | ||
+ | |||
+ | - Launch the emulator like normal, but at the boot screen, choose //Debug Mode//. | ||
+ | - When booting stops at a shell prompt, make the system volume writeable by typing this: '' | ||
+ | - Then edit Grub's boot menu: '' | ||
+ | - Look for the first line starting with ' | ||
+ | - Hit the //Esc// key to leave edit mode and save the file (type ': | ||
+ | - To make sure everything gets written to disk, remount back to read-only: '' | ||
+ | |||
+ | Now you can close the emulation window and start up again. | ||
+ | |||
+ | Well, no, doesn' | ||
+ | ====== Other Solutions ====== | ||
+ | |||
+ | ===== Using VirtualBox ===== | ||
+ | |||
+ | That's basically the same as when using Qemu, but with graphical user interface (GUI). Using a GUI doesn' | ||
+ | |||
+ | ===== Android Developer Tools ===== | ||
+ | |||
+ | **[[http:// | ||
+ | |||
+ | Well, if it boots at all. When doing a quick test with emulating a //Nexus One// with Android\_5.1.1 it didn't boot within 90 minutes. Trying Android\_6.0 on a //Nexus One// or a //Nexus 7// didn't even get that far, the emulator window simply vanishes a minute after launch. | ||
+ | ===== Ready-to-use Solutions ====== | ||
+ | |||
+ | You're not a DIYer? Then it's still possible to run Android apps on a PC. | ||
+ | |||
+ | ==== BlueStacks ==== | ||
+ | |||
+ | **[[http:// | ||
+ | |||
+ | ====== FAQ ====== | ||
+ | |||
+ | Some parts aren't exactly obvious, so let's try to find an answer. | ||
+ | |||
+ | === Android is based on Linux, right? Ubuntu is Linux based, too. So why can't one run Android apps directly on Ubuntu? === | ||
+ | |||
+ | That's correct, both operation systems are based on the Linux kernel. Still there are several reasons why one can't simply run application binaries made for one on the other one: | ||
+ | |||
+ | * Android and Ubuntu are customised differently. That's actually true for most Linux distributions, | ||
+ | * Having a need for custom binaries is usually no problem on Linuxes, because each distribution also comes with it's own package management or has tools to build binaries easily, so you can find all the applications custom-built for each distribution. But most Android apps are, unlike in the Ubuntu ecosystem, not Open Source, so another distribution can't recompile them. | ||
+ | * Android is built with phones and tablets in mind, which feature hardware typically not existing on desktop PCs. For example a telephony connection, a GPS receiver, a touch screen. Many Android apps expect such peripherals to be present, so they have to be emulated on the desktop. | ||
+ | |||
+ | === I've heard Android apps are actually Java apps, so why can't they run like any other Java application? | ||
+ | |||
+ | True, Android apps are written in Java. But it's a customised flavour of Java, so Ubuntus generic Java virtual machine isn't sufficient. AFAIK, the Android Java wasn't ported to generic Linuxes, yet, so it can't be installed on Ubuntu directly. | ||
+ | |||
+ | On top of this there' |
run_android_apps_on_ubuntu_desktop.txt · Last modified: 2018/05/27 16:10 (external edit)