Cross Platform
Android
iOS
Mac
Test Cloud

Debug on Device

This article will explain how to debug a Xamarin.Android application using either Xamarin Studio or Visual Studio.

Overview

It is possible to debug a Xamarin.Android on an Android device using either Xamarin Studio or Visual Studio. Before debugging can occur on a device, it must be setup for deployment and connected to your PC or Mac.

Debug Application

Once your device is connected to your machine, debugging a Xamarin.Android application is just like debugging anything else.

Firstly set your breakpoint as shown below:

Setting a breakpoint in Visual Studio:

Setting a breakpoint in Xamarin Studio:

Once you have set the break point, start debugging your application by hitting Cmd-Enter in Xamarin Studio on OS X or F5 in Visual Studio. When you do so, you may be prompted to choose the device you want to debug on, as shown in the following screenshot from Visual Studio:

Once the device has been selected, Xamarin.Android will connect to the device, deploy the application, and then run it. When the breakpoint is reached, the debugger will stop the application, allowing you to debug the application just like you would any other C# application. This is shown in the screenshots below

Visual Studio:

Xamarin Studio:

Summary

In this document we discussed how to debug a Xamarin.Android application by setting a breakpoint in Xamarin Studio and Visual Studio.