【问题标题】:NotSupportedException Could not activate JNI Handle - MvvmCrossNotSupportedException 无法激活 JNI 句柄 - MvvmCross
【发布时间】:2016-05-31 08:49:30
【问题描述】:

我最近在我的项目中将 MvvmCross 从 3.5.1 更新到了 4.1.4,并随之发布了应用更新。

在那之后,我从 Xamarin Insights 中看到,很多用户体验过;

Could not activate JNI Handle 0xffb35af8 (key_handle 0xe888654) of Java type 'md53997af0c1a24144057e197743f9f827a/HomeView' as managed type 'package.name.HomeView' 几乎所有的活动都有各自的活动名称。所有这些活动都是 MvxActivities。

我的 Setup.cs -

public class Setup : MvxAndroidSetup
{
    public Setup(Context applicationContext)
        : base(applicationContext)
    {
    }

    protected override IMvxApplication CreateApp()
    {
        return new MVVM.App();
    }

    protected override IMvxTrace CreateDebugTrace()
    {
        return new MvxDebugTrace();
    }

    protected override MvvmCross.Droid.Views.IMvxAndroidViewPresenter CreateViewPresenter()
    {
        var presenter = new MyViewPresenter();

        Mvx.RegisterSingleton<IMvxViewPresenter>(presenter);

        return presenter;
    }

    protected override void FillTargetFactories(MvvmCross.Binding.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry registry)
    {
        registry.RegisterCustomBindingFactory<View>(
                 "ShowMe",
                 v => new ViewScalingCustomBinding(v));
        registry.RegisterCustomBindingFactory<View>(
                 "ScaleMe",
                 v => new ViewSizingCustomBinding(v));
        registry.RegisterCustomBindingFactory<View>(
                 "CustomFont",
                 v => new FontCustomBinding(v));
        registry.RegisterCustomBindingFactory<View>(
                 "OtherCustomFont",
                 v => new FontDincCustomBinding(v));
        registry.RegisterCustomBindingFactory<View>(
                 "ImageResize",
                 v => new ImageResizeCustomBinding(v));
        base.FillTargetFactories(registry);
    }

    protected override IMvxPluginConfiguration GetPluginConfiguration(Type plugin)
    {
        if (plugin == typeof(MvvmCross.Plugins.DownloadCache.Droid.Plugin))
        {
            return new MvvmCross.Plugins.DownloadCache.Droid.MvxDownloadCacheConfiguration()
            {
                CacheName = "Pictures.MvvmCross",
                CacheFolderPath = "../Library/Caches/Pictures.MvvmCross/",
                MaxFiles = 500,
                MaxFileAge = TimeSpan.FromDays(1),
                MaxInMemoryBytes = 4000000, // 4 MB
                MaxInMemoryFiles = 1,
                MaxConcurrentDownloads = 10,
                DisposeOnRemoveFromCache = false
            };
        }

        return null;
    }
}

什么可能导致这个问题?

【问题讨论】:

  • 您可以展示其中一项活动吗?也许你的Setup.cs? 4 改变了很多东西,所以可能活动标题有问题。
  • 除了命名空间和命名空间相关的东西之外,我在 Setup.cs 中没有更改任何内容,但我可以将其添加到问题中。除了标签和屏幕方向之外,活动标题也没有任何特定内容。
  • 而且只有部分用户出现,你自己没有这个问题吗?
  • 没错,我看到很多用户体验过它,但在调试过程中我没有,我们的 QA 团队也没有。
  • 可能和安卓版本有关?您是否有任何来自受影响设备的信息?不确定像 MvxAppCompatActivity 而不是 MvxActivity 这样的东西是否会有所作为。

标签: c# android xamarin mvvmcross


【解决方案1】:

我在没有使用任何自定义视图的情况下遇到了该异常。只是尝试清理项目,它解决了我的问题,但是这种事情仍然让我害怕使用 Xamarin。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-20
    相关资源
    最近更新 更多