Debugging via an Android emulator

Android Studio creates includes an emulator by default. However, you can create emulators for other devices.

To create an Android emulator:

  1. Launch Android Studio. If you haven't installed it, do that first.

  2. Click the New Project button in the Welcome window.

  3. In the New Project window, click Next then click Finish.

  4. Android Studio will prepare the new new project. When it's done, click Finish.

  5. From the menubar, choose Tools > Device Manager.

  6. Click Create device. The Virtual Device Configuration window appears.

  7. For the best debugging experience, in the device listbox, choose one of the devices that has an icon in the Play Store column then click Next.

  8. On the System Image page, the appropriate Android version should already be selected. If the Next button is not enabled, click the Download button to download the system image.

  9. Click the Next button.

  10. On the Verify Configuration page, click Finish.

  11. The emulator you created appears in the Device Manager pane in Android Studio. Click the Play button to start your new emulator for the first time so that it can be ready to go when you use it in Xojo.

  12. You may now quit Android Studio and use the emulator in Xojo.

The first time you launch a Xojo app in an Android emulator you just created, it will take a minute or so to configure itself. After that, it launches and runs quite quickly.

Note

On macOS, the first time you run an Android emulator, macOS will display a dialog asking for permission to access system events. This happens because Xojo uses AppleScript behind the scenes to launch Android emulators.

Tip

If you're going to be building several different apps for Android, the default amount of storage the emulator has might not be enough. When creating your emulator, on the Verify Configuration page, click Show Advanced Settings then scroll the configuration list until you see the Internal Storage field. It defaults to 2048 MB. Increasing this will make the emulator run faster.

Note

As Google changes Android Studio, these steps may be not be 100% correct.