C# Xamarin Java.Interop error?

前端 未结 8 1862
一向
一向 2021-02-07 17:08

Hello since the last Xamarin update we get this error.

CS0012 The type \'IJavaPeerable\' is defined in an assembly that is not r

8条回答
  •  春和景丽
    2021-02-07 18:03

    In my case iOS and Android use the seem Business Layer when I run my android application works ok but when I run iOS show me the error You must add a reference to assembly 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

    The problem: I was using JSONObject from Org.Json

    https://docs.microsoft.com/en-us/dotnet/api/org.json.jsonobject?view=xamarin-android-sdk-9

    this dll just work with android

    I need change for JsonObject from System.Json

    https://docs.microsoft.com/en-us/dotnet/api/system.json.jsonobject?view=dotnet-plat-ext-2.1

    That was my solution, now my two applications work

提交回复
热议问题