Android App is too large and Linking disables functionality

…衆ロ難τιáo~ 提交于 2019-12-04 04:47:30

With MvvmCross, I generally use SDK Assemblies only.

To then workaround Linker fails for MvvmCross (and for general MonoTouch/MonoDroid issues) then I add LinkerPleaseInclude type files to trick the linker.

An example file is:

public class LinkerIncludePlease
{
    private void IncludeClick(View view)
    {
        view.Click += (s, e) => { };
    }

    private void IncludeVisibility(View view)
    {
        view.Visibility = view.Visibility + 1;
    }

    private void IncludeRelativeLayout(RelativeLayout relative)
    {
        relative.Visibility = ViewStates.Visible;
    }
}

from: https://github.com/slodge/MvvmCross/blob/vnext/Sample%20-%20TwitterSearch/TwitterSearch.UI.Droid/LinkerIncludePlease.cs

It is annoying to have to do this... but it doesn't take long - most apps don't actually bind to many different properties/events.

I changes the progressBar include method to

    public void Include(ProgressBar progressBar)
    {
        progressBar.Visibility = progressBar.Visibility;
    }

and it worked. I removed all the others and they all started working. I'm assuming this is working as it is testing both the getter and setter of the ProgressBar Visibility property.

If this is not the correct reason for this working could someone add a comment, so we can all unsterstand how to fix these issues in the future

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!