issues with MvvmCross and linking on Android

2019-02-19 10:13发布

I have an Android app using several MvxGridView with ItemsSource bound

  local:MvxBind="ItemsSource Groups;ItemClick ShowGroupCommand"
  local:MvxBind="ItemsSource Products;ItemClick ShowProductCommand"

When running app in Release mode, link behavior='Don't link', app size is 20MB!, everything works as expected.

Switching link behavior to 'Link SDK assemblies only', app size is 7MB, but when running I get unexpected behavior. Here is some of the app output which mention issues with the MvxGridView's ItemsSource binding:

http://pastebin.com/smDf1Ekc

I am aware of the linking options in Xamarin (here).

But I don't know what I should do in order to make it work.

I am working on a small pilot app, I need to send it to client to check it out. It won't look good sending 20MB when the full Android app I want to rewrite with Xamarin and MVVMcross is under 1MB. I already spent a lot of time on this issue with no luck, hope someone can help.

1条回答
啃猪蹄的小仙女
2楼-- · 2019-02-19 10:36

There are several ways to work around this including:

  • using a LinkerPleaseInclude.cs file - a starter one is included by default in the nuget packages (see LinkerPleaseInclude.cs)
  • using a Linker xml file - like the one ReactiveUI uses for MonoTouch - see Linker.xml

There are also plenty of questions and answers on here about this already:

查看更多
登录 后发表回答