Xamarin WebRTC
Published in

Xamarin WebRTC


In the previous articles, I showed you how to build and compile the WebRTC library for iOS and Android. In the end of both articles, we got a framework file for iOS and a aar file for Android.

As a Xamarin developer, these file formats are not compatible with your Xamarin Forms, Xamarin iOS or Xamarin Android projects. To solve this issue of incompatibility, we need to convert these libraries into a .DLL (DYNAMIC LINK LIBRARY) that is compatible with Xamarin.

Fortunately, in the Xamarin framework’s arsenal, there exists a tool for this referred to as XAMARIN BINDINGS and it is well documented how to create Xamarin binding libraries from several Native Library formats.

For this article we will be primarily focusing on Binding an AAR Library/File. The Link below is a detailed Microsoft documentation that shows you how to set up and build a Xamarin binding library using .AAR file:

Binding an .AAR

You might have realized that once you attempted to build the library, you were met with an error like the one pictured below:

‘Value’: member names cannot be the same as their enclosing type.

This is due to rule in C# which states a property cannot have the same name as the class it belongs to. For instance, a class called “WebRTC” cannot have a property named “WebRTC”. A solution to this is to open the Metadata.xml found in the Transforms folder of your solution and add the following line to the file.

<attr path=”/api/package[@name=’org.webrtc’]/class[@name=’StatsReport.Value’]” name=”name”>StatsValue

<attr path=”/api/package[@name=’org.webrtc’]/class[@name=’StatsReport.Value’]” name=”name”>StatsValue

This renames the offending property name “StatsReport.Value” to “StatsValue”. Once this is done, rebuild your project in either Release and/or Debug mode and it should build successfully.

If you navigate to your bin folder you should see either a Debug or Release folder depending on the build configuration you selected. Inside these
folder, you will see the DLL file that was created.

bin folder builds
Debug folder DLL
Release folder DLL

The code base for this article and other relating articles can be found here:

GITHUB REPO: Xamarin-WebRTC-Tutorial

If you want to delve further into troubleshooting tips for Xamarin Binding of .AAR Libraries, you can check out this link:

Troubleshooting Bindings




An 8 part series that delves into the building of WebRTC libraries for Xamarin Apps

Recommended from Medium

Create Api without backend (Easy)

Java vs. Kotlin: Which is the Better Option for Android App Development?

Install Terraform in Three Simple Steps

Dinamic Libraries in C Lenguage

How to Migrate Your Core Data Systems — With Examples!

Switch from Meteor to GraphQL: Secrets of Hassle-Free Migration Process

Android vs IOS: Which is a better platform for Mobile App Development

Using the Ruby Soda, Active Hash and Chartkick gems to track COVID-19 cases in Connecticut

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Paula Aliu

Paula Aliu


More from Medium

Prediction of Dog Breeds using transfer learning

The Evolution of Virtualization

A Conversation with Mayalen Etcheverry

Understanding Factory Method with a Factory Design Pattern Case Study