How to add reference to Mono.Android?

12,523

Solution 1

Assuming that you have X.Android installed, right click your solution. Then Add -> Add new Project -> Android -> Android Library Project.

There is no reference you would have to add.

enter image description here

Solution 2

If you want to support more than simply Xamarin.Android in your Library project, you have the possibility of using a Portable Class Library (PCL). I find the profiles 78 and 158 to work very well and both provide await/async support.

However you should not that the PCL's only support the minimum subset of the targets in the profile. Hence, not everything in .NET 4.5 is available, and you won't be able to do platform specific things inside of it, unless you abstract it away. This could be achieved by creating Interfaces and injecting the implementations using IoC.

IoC can be provided by TinyIoC and the IoC inside of MvvmCross.

Solution 3

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\Mono.Android.dll

For VS2017, the libarary can be found at above location.

Share:
12,523
Erik Z
Author by

Erik Z

Updated on June 25, 2022

Comments

  • Erik Z
    Erik Z almost 2 years

    I'm developing a class library for Android using Xamarin Studio. How do I add a reference to Mono.Android in my library project? Mono.Android is not in the list of available assemblies.