How to test an Android application being created ?
You have 2 options:
- Connect an Android device to your computer with a USB cable (phone, tablet…),
- Create “virtual” devices that will run on your computer. Android will run as any software on your computer.
The 2nd solution has the advantage of allowing you to test your application in all possible configurations, without having to buy the corresponding hardware. It is simple and inexpensive.
Creating a virtual Android device
Launch Android Studio and click on this icon.
AVD (Android Virtual Device) starts. This application allows you to create virtual devices.
Click Create a virtual device and select a device category and a device in the list such as below.
Click Next and you can choose some options like your device name.
Once saved (click Finished), you can “start” your device by clicking on the green triangle 🙂
You can also remove the skin (in the virtual device settings).
Install your application on a virtual machine
It’s very simple. Also in Android Studio, click on this button to run your application:
Android Studio shows a list of real or virtual devices connected to the computer.
In our example we have only one virtual machine started.
You click OK. Your application must run on the virtual device.
Be careful, you must start the virtual machine before installing an application. Have you ever try to install an application on your phone when it’s off ? :p
This post is also available in 2 - Lire cette page en français.