This document describes how to get started with emulator development under windows. If you want to use your own machine you can skip the sections on cloud an gWindows.
This section is only relevant if you work at Google.
In order to develop the android emulator in gWindows you will need to meet the following requirements.
Note: The gWindows machines are locked down very well and you will experience some performance penalties due to this. You are highly encouraged to develop in GCE
This section is only relevant if you want to setup a development environment in google cloud.
First we need to create a Windows image with nested virtualization enabled:
Note: this is not officially supported, but we have not seen any issues.
$ WIN_VER=windows-2012-r2 && ZONE=us-west1-b && gcloud compute disks create nested-$WIN_VER \ --image-project=windows-cloud \ --image-family $WIN_VER \ --zone $ZONE \ --size 500GB --licenses "https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx" && gcloud compute images create nested-$WIN_VER-image \ --source-disk nested-$WIN_VER \ --source-disk-zone $ZONE \ --licenses "https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
You can change the family to the latest windows version, and of course set the zone and disk size to your liking. Do not pick a core edition, as you will want to have a shell.
Next we create an instance and install all the necessary things
$ gcloud compute instances create \ $USER-windows-development-01 \ --zone $ZONE \ --min-cpu-platform "Intel Haswell" \ --image nested-$WIN_VER
You will need to setup the password, after which you should be able to login.
gcloud beta compute reset-windows-password \ $USER-windows-development-01 \ --zone=$ZONE --user=$USER
Install the following:
If you are using Chocolatey, you can install all the dependencies with the following command in an elevated terminal window (i.e. type Win-R key then type “cmd”):
C:\>@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" C:> choco install -y visualstudio2019community visualstudio2019buildtools visualstudio2019-workload-python visualstudio2019-workload-nativedesktop visualstudio2019-workload-vctools git vscode python3
You must run visual studio at least once to accept a license and do some initial configuration.
Make sure your account has SeCreateSymbolicLinkPrivilege. The easiest way to make sure you have this is to open every terminal window with administrator privileges.
Once you have installed everything you can validate that you have what you need on the path by executing:
C:\> where git && where python
You will need to setup your name and make sure you enable symlinks. Repo will do its best to work without symlinks enabled, but we have not tested this. Make sure you have the following settings set:
C:\> git config --system core.symlinks true C:\> git config --global core.symlinks true C:\> git config --global user.name "I just copy pasted this without looking" C:\> git config --global user.email email@example.com
Note: The instructions in this section are for using the native Windows version of the
repo tool, where “native” is used to mean without “cygwin”.
There are 2 advantages running with Windows native tools:
From an elevated command prompt execute:
C:> mkdir %USERPROFILE%\bin && cd %USERPROFILE%\bin && curl -o repo http://storage.googleapis.com/git-repo-downloads/repo && echo @call python %~dp0repo %* > %USERPROFILE%/bin/repo.cmd
Make sure to add
%USERPROFILE%\bin to the
PATH, otherwise you will not be able to use repo.
You can initialize repo as follows:
C:> cd %USERPROFILE%\src && mkdir emu-master-dev && cd emu-master-dev C:> repo init -u https://android.googlesource.com/platform/manifest -b emu-master-dev --worktree
Note: we are not using persistent-https to initialize the repo, this means performance will not be as good as it could be.
Sync the repo (and get some coffee, or a have a good nap.)
C:> cd %USERPROFILE%\src\emu-master-dev && repo sync --no-tags --optimized-fetch --prune
Congratulations! You have all the sources you need. Now run:
C:> cd %USERPROFILE%\src\emu-master-dev\external\qemu && android\rebuild
You should end up with an emulator in the objs directory.
You can pass the flag
--help to the rebuild script to get an idea of which options you can pass in.
Setup git cookies so you can repo upload by following this link: https://www.googlesource.com/new-password.
Make sure you have configured the proper user name and email address:
C:\>git config --global user.name "I just copy pasted this without looking" C:\>git config --global user.email firstname.lastname@example.org
Here you can find more details on submitting patches.
Our cmake files rely on the visual studio environment variables to be set as they are used to properly configure the compiler toolchain. The easiest workaround is to start visual studio code from the command line after loading the visual studio variables. Look for the line:
Accepted, setting env with in the output from
The easiest way to get started is to install android studio:
C:> choco install androidstudio
Next you can launch android studio and install a series of avds that you can use