mvvmcross上发布的交换机绑定失败 [英] mvvmcross binding on switch fails on release
问题描述
我有一个奇怪的错误在我MVVMCross应用程序。
考虑以下情形:
<开关
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:可聚焦=假
机器人:可点击=假
机器人:layout_alignParentRight =真
机器人:ID =@ + ID / activatedSwitch
本地:MvxBind =选中IsActive/>
- 编译版本:14级
- 最低版本:14级
-
目标版本:14级
-
链接:SDK组件仅
-
Android手机版本是4.1.2。
当我运行的调试模式的应用程序,一切正常。
但是,当我在运行它的发布,以Checked属性绑定失败,出现以下错误:
E / MvxBind(11670):找不到12,70视图类型 - 开关
块引用>解决方案由于MvvmCross使用反射来执行绑定,则链接器不会看到
经过
财产,不包括它在你的二进制文件。有一个文件名为LinkerPleaseInclude.cs
您可以编辑添加一个引用这个属性。是这样的:
公共无效包含(开关@switch)
{
@ switch.CheckedChange + =(发件人,参数)=> @ switch.Checked = !@switch.Checked;
}I have a weird bug in my MVVMCross app.
Considering the following scenario:
<Switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:clickable="false" android:layout_alignParentRight="true" android:id="@+id/activatedSwitch" local:MvxBind="Checked IsActive" />
- Compile version: level 14
- Minimum version: level 14
Target version: level 14
Linking: Sdk Assemblies Only
Android Phone version is 4.1.2.
When I run the app in Debug mode, all is ok.
But when I run it in Release, the binding to the Checked property failed with the following error:
E/MvxBind (11670): 12,70 View type not found - Switch
解决方案Since MvvmCross uses reflection to perform databinding, the linker is not seeing the
Checked
property and is not including it in your binary. There is a file nameLinkerPleaseInclude.cs
that you can edit to add a reference to this property.Something like:
public void Include(Switch @switch) { @switch.CheckedChange += (sender, args) => @switch.Checked = !@switch.Checked; }
这篇关于mvvmcross上发布的交换机绑定失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!