Android Studio AVD emulate

43 views
Skip to first unread message

Andrzej Andrzej

unread,
Sep 13, 2018, 12:27:09 PM9/13/18
to qubes...@googlegroups.com
Any idea?

pixel fairy

unread,
Oct 8, 2018, 7:47:28 AM10/8/18
to qubes-users
On Thursday, September 13, 2018 at 9:27:09 AM UTC-7, Andrzej Andrzej wrote:
> Any idea?

If you really want to do it on your own host, AVD manager / create virtual device / choose device / select system image / Other Images / click "download" on an android image and finish.

but thats very slow and tends to be error prone. take advantage of our networked world, and run a vagrant server. host os linux, with vagrant-libvirt (which uses kvm) and make sure nested virtualization is enabled, which is why your not going to use virtualbox for this. then grab this script, https://gist.github.com/xahare/1db2970b7b684c0d54c0c15cc32afb98 and set a VAGRANTHOST in your .bashrc
also, vagrant plugin install vagrant-sshfs

you can install virt-manager in the fedora-28 templatevm, and set it to your vagranthost. you'll have to remove its connection to localhost (xen).


in my case, i added src to .gitignore (so it doesnt get clobbered) and rsync that code as needed. rvagrant uses .gitignore, but you dont need a git repo there. you can make your git repos in your studio projects instead.

if you do a vagrant halt and up, (like after software updates) run vagrant provision to fix the permissions of /dev/kvm (it will complain about snap installing an existing package. you can ignore that)

the first time the emulator runs, it will be slow, but after that, its fast enough that all this trouble is worth it.

heres my Vagrantfile. my vagrant host only has 2 cores, but i suggest 4 if you have the hardware. and yes, you really want 10 gigs of ram in it. android studio is a hog.

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

setup = <<-SCRIPT
apt-get -y install vim-gtk3 git openjdk-8-jdk openjdk-8-jre
snap install android-studio --classic
chgrp vagrant /dev/kvm
chmod g+rw /dev/kvm
SCRIPT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "peru/ubuntu-18.04-desktop-amd64"
config.vm.synced_folder "src", "/home/vagrant/src", type: "sshfs"
config.vm.provider "libvirt" do |lv|
lv.nested = true
lv.cpus = 2
lv.memory = 10240
end
config.vm.provision "shell", inline: setup
end

Reply all
Reply to author
Forward
0 new messages