To start developing Android applications, one has to set up a proper development environment. It facilitates developers to use the tools needed in creating an app and ensure that all operations/processes carried out in a smooth manner. An IDE(Integrated Development Environment) is a complete application suite that provides services like writing and editing of source code, building executable files, and debugging. Visual Studio is one of the popular IDE that is used for developing cross-platform mobile applications. Both Android and iOS mobile applications can be developed using this IDE. This article covers the step-by-step approach to install and set up the Visual Studio on the computer system in order to start the android app development journey.
Step 1: Download the Visual Studio file from the official website
Head over to the official Microsoft website for Visual Studio using this link. The community version of the IDE is free to use. Download the .exe file and run it on the computer.
Step 2: Choose appropriate Workloads
On opening the .exe file of Visual Studio, it will demand to select the Workloads. Workload determines the usage of the IDE, i.e., what stuff will be developed on it. Select Mobile Development with .NET and if Android SDK is not already installed on the computer then also select the checkbox on the right-hand side. Click on Install.
Step 3: System Reboot
Once all files get downloaded and installed, the Visual Studio will demand to reboot the system. As this step is crucial for the smooth installation of software, click on Restart.
Step 4: Log in to your Microsoft account
One needs to login with a Microsoft account in order to use Visual Studio. Log in if already created, otherwise create one for the same. Select the desired color theme and click on “Start Visual Studio”.
Step 5: Create a new Project
In the next dialog box, click on “Create a new project” option. It will open a window to choose project type and platform for preferred development. Select “Mobile” in the dropdown menu of Project type and select Mobile App(Xamarin.Forms) from the given list.
Step 6: Configure the Project
Give the desired name and location to the project and click on “Create”. In the next dialog box, choose a blank template for the application and click on “Create”.
Step 7: Project files
Open the MainActivity file of the application by clicking on the MainActivity.cs file under the Android heading at the right side menu. Similarly, to open the XML layout file of the application, click on MainPage.xaml file present in the right menu.
Step 8: Configure Virtual Device(Emulator)
Emulators run the android applications on the computer system i.e., developers don’t need a real android device to run/test the applications. To set up an Emulator, open the Android Device Manager. Choose the default setting and click on “Create”.
The device name will now appear in the Android Device Manager list. Click on the Run button of the device(present in the rightmost column of the manager) to launch the device as an emulator.
If someone has used any Android development IDE like IntelliJ IDEA or Android Studio and had installed an Emulator device earlier and that device name and configuration will appear in the list of Android Device Manager. Navigate to the Tools menu at the top and open Android -> Android SDK Manager. Make sure that the target API of the device is installed in the Visual Studio IDE, if not then install the SDK platform mentioned under the OS version of the device.
Step 9: Run the application
Once the emulator has been configured successfully, the device name will appear beside the Run icon present on the toolbar of the IDE. Click on the Run icon and the application will be launched on the Emulator.