2016-05-31 70 views
6

我最近在項目中將MvvmCross從3.5.1更新到了4.1.4,併發布了應用更新。NotSupportedException無法激活JNI Handle - MvvmCross

之後,我從Xamarin Insights看到,有很多用戶體驗;

Could not activate JNI Handle 0xffb35af8 (key_handle 0xe888654) of Java type 'md53997af0c1a24144057e197743f9f827a/HomeView' as managed type 'package.name.HomeView'幾乎所有活動都有其各自的活動名稱。所有這些活動都是Mvx活動。

我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; 
    } 
} 

什麼可能會造成這個問題?

+0

你可以展示其中的一個Activites嗎?也許你的Setup.cs?不止4件事情發生了變化,所以也許活動頭文件有問題。 – Cyriac

+0

除了命名空間和命名空間相關的東西,我沒有改變Setup.cs中的任何東西,但我可以將它添加到問題中。除了標籤和屏幕方向外,活動標題還沒有任何特定內容。 –

+0

它只出現在一些用戶,你自己沒有這個問題? – Cyriac

回答

2

我有沒有使用任何自定義視圖的異常。只是試圖清理這個項目,它解決了我的問題,但是仍然有這樣的事情讓我害怕使用Xamarin。