无法激活 java 类型 MvxRecyclerView 的 JNI 句柄

Could not activate JNI Handle of java type MvxRecyclerView

我想实现 MvxRecyclerView,但在 SetContentView() 运行时出现以下异常:

System.NotSupportedException: Could not activate JNI Handle 0x32700041
(key_handle 0xb29d17e8) of Java type
'mvvmcross/droid/support/v7/recyclerview/MvxRecyclerView' as managed
type 'MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView'.

我使用的是 Xamarin.Android.Support.. (23.3.0) 和 MvvmCross (4.1.6 / 4.1.7) 的最新 NuGet 包。

知道导致此异常的原因吗?

Ken Kosmowski 现在提供了有关此问题的更多信息: https://github.com/MvvmCross/MvvmCross-AndroidSupport/issues/252

使用那里引用的@kjeremy 的解决方法,直到问题得到解决: "The workaround consists of adding Resources\values\attrs.xml file to your Droid project with the following content:"

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <declare-styleable name="MvxRecyclerView">
    <attr name="MvxItemTemplateSelector" format="string" />
  </declare-styleable>  
</resources>

为了完成目的。

使用 MVVMCross 4.2.0

您应该删除 attrs.xml 并将所有 MvxItemTemplateSelector 引用更改为 MvxTemplateSelector。