Release build gives "LinkAssemblies task failed unexpectedly" - how to debug it?

Debug build works fine.
Setting Linking to 'None' works but results in an APK 10x normal size (47MB versus 4.6MB for debug build) (I've tried all options - SDK only, SDK & User),
Release build with Linking set to "Sdk Assemblies Only" gives this specific error:
System.Void Xamarin.Forms.Platform.Android.NativeViewWrapperRenderer::OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.Platform.Android.NativeViewWrapper>)' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> System.ArgumentNullException: Value cannot be null.

I've read through lots of threads talking about this issue back in 2015, but I presume using API after version 15 solved all those.
Compile Using: "use latest platform (Android 7.1 (Nougat))
Min Android Version: Android 6.0 (API level 23 - Marshmallow)
Target Android Version: Android 7.1 (API level25 - Nougat)

Cleaned solution, and rebuilt - still have the problem.
All packages refreshed though NuGet 2 weels ago - so all should be pretty much current.

I therefore suspect that the error message is pointing to something I've done wrong, and there's an element in my Xamarin.forms that has an on event changed handler assigned, but it doesn't exist, or the args are wrong? Not sure how to track it down.

I've looked through the code and there are no handlers declared for anything that doesn't exist.
- two buttons have Clicked=... in their XAML
- one entry has Completed=... in its XAML
- one ListView has ItemSelected = ...

Any ideas on next steps to solve this? I'm looking at deleting the controls with handlers one by one to see if the error goes away...

Tagged:

Posts

  • gregmatthewsgregmatthews GBMember ✭✭

    Digging into a detailed build log I find this:
    There was a conflict between "Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

    It looks like MonoAndroid\v1.0 references C# 2.0.5.0
    It looks like NewtonSoft.Json.10.0.0.3 references c# 4.0.0.0

    Is this a possible cause? how do I remedy it?

  • gregmatthewsgregmatthews GBMember ✭✭

    no joy all day on this
    1. Can't seem to build a release version due to the bug above
    2. I can install a debug version connected over USB, and that starts and runs even when disconnected from the PC
    3. If I take the signed *.apk and manually copy it to the phone and install it (Allow unknown source etc.) then I get a white screen, nothing on it

    For what I'm doing I need a valid *.apk, don't care if its got the debug flag on, that I can install manually (not via Debug from Visual Studio) by copying the file to device and installing it from there.

    Can anyone help?

Sign In or Register to comment.