XAMARIN - Mono.Android - Class ref in pre-verified class resolved to unexpected implementation

95 Views Asked by At

I've used ILRepack to merge a bunch of DLLs into a final Merged.dll with

ILRepack.exe /verbose /out:C:\..\.Merged.dll /wildcards *.dll /lib:C:\.MonoAndroidPath.\v8.1

Some of the merged DLLs use Mono.Android.dll functionality and I do not want to merge that in as I believe it to be wrong and also the output assembly will go at ~30MB.

That's why instead of merging it I used the /lib feature of ILRepack to specify a reference. /lib:C:\.MonoAndroidPath.\v8.1 is the path to the Mono.Android.dll also used by the xamarin solution.

When I use the Merged.dll in the app, it does compile but when the app is about to start I get

Java.Lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

Is there any way to solve this?

The solution does work if all of the DLLs are added separately.

Edit:

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation getting while running test project?

I did read through this post and similar ones, but they relate to an Android solution and not to a Xamarin solution. I couldn't translate so far the solution provided there to my case. So please do not close this question as it is still relevant.

0

There are 0 best solutions below