Question

In my Android MvvmCross app, my ToggleButton bindings work like a champ for Debug builds, but fail for Release.

My ToggleButton and binding definition is similar to the following:

    <ToggleButton
        android:id="@+id/MyToggle"
        local:MvxBind="Checked MyToggleChecked" />

If I enable debug output for my release build, I get see the following log output:

MvxBind:Error:113.19 View type not found - ToggleButton
[0:] MvxBind:Error:113.19 View type not found - ToggleButton
03-04 14:38:41.005 I/mono-stdout(25265): MvxBind:Error:113.19 View type not found - ToggleButton

My MvvmCross assemblies are version v4.0.30319, my MvvmCross.Droid assemblies are v2.0.50727 (Hmm... is that a problem?)

Any ideas? (Thanks in advance to Suart. ;-)

Was it helpful?

Solution

As per the link Stuart Lodge's comment, the problem is due to the linker not including the reflected property referenced in the MvxBind expression.

I added a class with an explicit reference to the property to force inclusion by the linker, now all is well with my Release build!

internal class LinkerForceInclude
{
    private LinkerForceInclude()
    {            
    }

    private void IncludeChecked(ToggleButton button)
    {
        button.Checked = !button.Checked;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top