Use the Android Emulator to test AR scenarios without a physical device. The Android Emulator lets you run ARCore apps in a virtual environment with an emulated device that you control.
Set up your development environment
If you're using Sceneform in your app, you'll also need:
Development machine that supports OpenGL ES 3.1 or later.
This enables the necessary graphics emulation in the Android Emulator.
Get Android Studio and SDK tools for ARCore
Install Android Studio 3.1 or later.
In Android Studio, go to Tools > Android > SDK Manager.
By default, the System Settings > Android SDK menu opens.
In the Android SDK menu, select SDK Platforms and click Show Package Details.
Under Android 8.1 (Oreo), select:
Google APIs Intel x86 Atom System Image API Level 27, version 4 or later.
In the Android SDK menu, select SDK Tools and add Android Emulator 27.2.9 or later.
Click OK to install the selected pacakges and tools.
Create a virtual device with AR support
You can follow the Android Studio instructions to Create a Virtual Device with AR support.
Configure the virtual device
- Select the Pixel or Pixel 2 hardware profile.
- Select the Oreo: API Level 27: x86: Android 8.1 (Google APIs) system image.
Confirm that your virtual device is configured correctly:
- Go to Verify Configuration > Show Advanced Settings.
- Make sure that Camera Back is set to VirtualScene.
Run your app
Test an ARCore app on an AR-supported virtual device in the emulator. To do this, you can follow the Android Studio instructions to Run an app in the Android Emulator.
Sceneform requires OpenGL ES 3.1.
Make sure your emulator is configured to use the latest version.
In the menu, select Settings > Advanced > Renderer maximum (up to OpenGL ES 3.1).
Run the emulator using the AVD your created above and check the OpenGL ES version being used by the emulator:
adb logcat | grep eglMakeCurrent
If you see
ver 3 1in the output, then you can run Sceneform apps:
… … … … D EGL_emulation: eglMakeCurrent: 0xebe63540: ver 3 1 (tinfo 0xd104cb40)
If you see a lower version, then your development machine does not support OpenGL ES 3.1 and you must use a physical supported device to run Sceneform apps.
The version of ARCore on the emulator is likely out-of-date. Follow these instructions to update it:
Download the latest ARCore_*_x86_for_emulator.apk from the GitHub releases page.
Install the downloaded APK into each AVD you'd like to use:
Start the desired AVD, then drag the downloaded APK onto the running emulator, or run
adb install -r ARCore_*_x86_for_emulator.apkto install it from the terminal while the virtual device is running.
Repeat this process for any additional AVDs you'd like to use.
Control the virtual scene
When your app connects to ARCore, you’ll see an overlay describing how to control the camera and a status bar below the emulator window.
Move the virtual camera
Press and hold Option (macOS) or Alt (Linux or Windows) to access camera movement controls. Use the following controls to move the camera:
|Platform||Action||What to do|
|macOS||Move left or right||Hold Option + press A or D|
|Move down or up||Hold Option + press Q or E|
|Move forward or back||Hold Option + press W or S|
|Change device orientation||Hold Option + move mouse|
|Linux or Windows||Move left or right||Hold Alt + press A or D|
|Move down or up||Hold Alt + press Q or E|
|Move forward or back||Hold Alt + press W or S|
|Change device orientation||Hold Alt + move mouse|
Release Option or Alt to return to interactive mode in the emulator.
Use the Virtual Sensors tab in Extended controls for more precise device positioning.
Add Augmented Images to the scene
Load images into the emulator’s simulated environment to test Augmented Images.
Use the Camera tab in Extended controls to add or modify Scene images. There are two image locations, one on the wall and one on the table.
To view these image locations in the scene, launch your emulator, then move the camera to the dining room area through the door behind the camera’s starting position.
If your ARCore app launches and you see an "AR Core not supported" message, check the revision on your system image. Make sure you are using API Level 27 Revision 4.
If your ARCore app fails to open the camera when it launches, make sure that Camera Back is set to VirtualScene, as described in the configuration steps above.