How-To's

AndroidManifest.xml, Logcat and Android Profiling – Xamarin Android in Rider 2019.1

This is the second post looking at the updated features in Rider 2019.1 for Xamarin Android. In the previous post, we covered Xamarin Android Visual Designer and Layout Inspector. In this post, we will cover several new UI-based development features for the Android flavor of Xamarin.

We will look at working with the AndroidManifest.xml file, the Logcat Tool Window, Android Profiler, and more. We are very excited to be bringing these to everyone to have the best experience developing Xamarin projects.

AndroidManifest.xml Code Completion

Editing the AndroidManifest.xml file for a Xamarin has not been easy by hand. Now, with the ability to add and modify elements in the file, developers can quickly add and update the elements of the manifest such as <uses-sdk> or <activity>.

The AndroidManifest.xml file contains important information for our Android applications like defining the packaging name and components used in the project and gives the Android operating system information on resources that need permissions. We do not need to look up names for the permissions for accessing contacts, using location services or sending SMS.

Rider's Xamarin Manifest XML Completion

Logcat Tool Window

The need to debug and examine the logs on remote and emulated Android devices is key to the Xamarin development process and that is the expertise of the new Logcat Tool Window. To open this Tool Window, go to View | Tool Windows | Logcat.

With Logcat, you can connect and observe any process on the selected device through the dropdown lists at the top of the window. We can also filter the logs to see the information we want again through a dropdown located along the top of the window: Verbose (All), Debug, Info messages, Warnings, Errors, and Asserts. Now we get this of this information within the Rider IDE at our fingertips.

Rider's Xamarin Logcat ToolWindow

Android Profiler

The Android Profiler Tool Window is the best way to explore and find those areas where our Xamarin projects may need to be looked at further. With the profiler active, we can see the CPU, memory and network utilization of the selected process running on the Android device.

This is also nice to look at other processes that may be consuming more resources while the Xamarin Android app is running and being tested. To open this Tool Windows, go to View | Tool Windows | Android Profiler.

Rider's Xamarin Android Profiler

Device File Explorer Tool Window

To view the files on the connected Android device or emulator, use the Device File tool window. You will find it in the menu under Tools | Android | Device File Explorer. This tool window is useful to examine files that are created by your app, or if you need to transfer files to and from a device.

Rider's Xamarin Device File Explorer

AVD Manager

With a large number of Android devices in the market today, we need to test on a wide number of device configurations. Having enough physical devices is not possible sometimes and that is why we need to have virtual devices for testing purposes.

Using the AVD Manager in Rider keeps track of the Android devices at our disposal for testing Xamarin projects. With the AVD Manager, we can create not only Android phone emulators but also wearables, tablets and TV emulators for a richer test environment. You can find the AVD Manager under Tools | Android | AVD Manager.

Rider's Xamarin AVD Manager

Creating New Virtual Devices

To create a new Android virtual device, select the + Create Virtual Device… button located on the AVD Manager dialog. We will be presented with a wizard that will walk through the process and allow us to selected either a brand and model of Android devices or we can create or import new profiles. The new virtual device will then be present in the AVD Manager for testing our Xamarin projects.

Rider's Xamarin New Virtual Device Dialog

Analyze APK Files in Rider

We can also analyze Android application package files (APK) inside Rider. To open a .apk file selected Tools | Android | Analyze APK…. We will be presented with a dialog to locate and select the file to be opened. This helps us to inspect embedded .dex files (Dalvik Executable Format, the bytecode of our Android program), track resources within our app, and even help reduce the size of our APK so users can download it faster.

Rider's Xamarin Select APK File

Once opened, the APK file can be audited in Rider’s window as shown below.

Rider's Xamarin Analyze APK Window

The additions and updates in the latest version of Rider for Xamarin Android development are a huge step forward!

Download Rider 2019.1 and give it a try! We’d love to hear your feedback regarding the entire Xamarin development experience!

image description