62

My code works fine, but when I added fragments with a new namespace to the project, I began getting the error

You need to add a reference to Mono.Android.Export.Dll when you use ExportAttribute or ExportFieldAttribute

I've searched online and found several mentions of unlinking assemblies, but I've also read that this will cause additional errors.

Does anyone know how to solve this bug?

Falko
  • 17,076
  • 13
  • 60
  • 105
Rupert
  • 4,209
  • 7
  • 31
  • 36

5 Answers5

133

I found the answer. Right click references and search Export. Just add the Mono.Android.Export to your project.

Ehsan Sajjad
  • 61,834
  • 16
  • 105
  • 160
Rupert
  • 4,209
  • 7
  • 31
  • 36
51

enter image description here I added reference like @Jeremy Said, it's working

Arun Prasad E S
  • 9,489
  • 8
  • 74
  • 87
  • in my Visual Studio 2017, I am targeting MonoAndroid 5.0, and I see only one Mono.Android.Export.dll, that is from 7.1. Can I find older versions of Mono.Android.Export.dll anywhere to download? – Lupu Silviu May 16 '17 at 10:02
  • @LupuSilviu Usually all dlls are individually avaliable to download. Please try searching for it. – Arun Prasad E S May 16 '17 at 14:07
15

If you're using JetBrains Rider, you can solve the issue by adding the Mono.Android.Export reference to your Android .csproj file:

<!-- ExampleApp.Android.csproj -->
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    ...
    <ItemGroup>
        <Reference Include="Mono.Android" />
        <Reference Include="Mono.Android.Export" />
    </ItemGroup>
    ...
</Project>
Ryan Payne
  • 5,249
  • 4
  • 28
  • 69
3

You don't need download dll from the web if you cant find it in the reference manager

just do following steps:

  1. Set the target framework to Android 4.4 kit kat
  2. Add reference mono.android.expert.dll
  3. set targetFramework as last good target framework

Clean solution and rebuild

I hope it helps you.

Ali Besharati
  • 918
  • 12
  • 25
0

If you're using VS 2022 (like @Siddhant maurya):

  • Right click the "References" folder of the project that gets the error.
  • Choose "Add project reference".
  • In the "All" tab select "Mono.Android.Export".
  • Press "Select".
  • (optional) Close VS 2022 and open explorer(Windows) or finder(MacOS) to remove for every project in the solution the "bin" and "obj" folders.
  • (optional reopen VS 2022) Rebuild the solution.
hw_1283
  • 1
  • 2