How To Run Xamarin Android App In Android Phone Using Visual Studio 2015 Update 3

Introduction

Xamarin is a platform to develop the cross-platform and multi-platform apps (Ex. Windows phone, Android, iOS). In Xamarin platform the code sharing concept is used. The Xamarin Studio is available in Visual Studio also.

Prerequisites

  • Visual Studio 2015 update 3

The following steps need to be followed in order to run the Xamarin Android App in Android phone, using Visual Studio 2015 Update 3.

Step 1 - Go to Visual Studio.

Click File--> select New--> Project (or press Ctrl+Shift+N).

Project

Step 2 - After opening the New Project, select Installed--> Templates -->Visual C# --> Android. In the right side pane, choose Blank App (Android).

Next, give your Android app a name (Ex:sample), and give path of your project. Finally, click OK.

New Project

Step 3 - After creating a new project, the Get started with Xamarin window shows up. Now, you can develop your app.

develop your app

Step 4 - Go to the Solution Explorer. All files, platform files, and assets are available in Solution Explorer.  

Go to the appname --> select Resource --> Layout folder--> Main.axml.

In Main.axml page, go to the source section to write the xaml code.

If you want to design your app using GUI, choose the design window. 

design your app

Step 5 - After opening the main.axml page, design the User interface into whatever you want. You can do it through coding or you can design your app by the drag and drop method.

design window

Here is the source section where you can write the code for your app's design.

code

Step 6 - Take any Android mobile phone. Go to the Settings.

settings

Step 8 - Go to About Phone option.

settings

Step 9 - Now, tap seven times on Build Number to enable the developer mode in your Android device. It will display a message, "You are now a developer!" 

 build number

Step 10 - Now, you will be able to see Developer options. Just click on that.

Developer options

Step 11 -  Here, enable the USB debugging option. 

usb debugging

Step 12 - Next, connect Android phone to your system or laptop via USB cable.

USB debugging

Step 13 - Next go to Visual Studio.

If your Android phone is connected, it will show up in the run menu (Ex: Micromax E481 (Android 5.1-API 22) of VS. Go click the connected Android phone and the app will start running in your Android device.

code

Output
It will take some time to run the app because it is first built in your phone, then installed, and then run in your phone.

So it will take some time.

app

Summary

So this was the process of running the Xamarin Android App in Android phone, using Visual Studio 2015 Update 3.


Similar Articles