在Xamarin MvvmCross中显示来自动态加载的程序集的Android视图

时间:2015-12-03 16:56:37

标签: c# android xamarin xamarin.android mvvmcross

我正在为使用MvvmCross的Xamarin编写的Android应用程序编写一个插件管理器。

我正在加载程序集,我可以枚举所有类型(ViewModels,Views,...)。对于视图类型查找,我实现了在安装期间注册的自定义IMvxViewFinder

protected override IMvxAndroidViewsContainer CreateViewsContainer(Context applicationContext)
{
    var androidViewsContainer = base.CreateViewsContainer(applicationContext);
    var viewsContainer = androidViewsContainer as IMvxViewsContainer;
    if (viewsContainer != null)
    {
        viewsContainer.AddSecondary(new PluginViewFinder());
    }

    return androidViewsContainer;
}

我能够将外部视图模型与外部视图类型相匹配。命中所有函数并返回正确的视图。但我仍然得到一个没有找到异常的课程

Java.Lang.ClassNotFoundException: Didn't find class "md5996393b23f6d276fda35c7846aecfb34.FirstView" on path: DexPathList[[zip file "/data/app/test.droid-1/base.apk"],nativeLibraryDirectories=[/data/app/test.droid-1/lib/arm, /vendor/lib, /system/lib]]
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <filename unknown>:0 
  at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00064] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:195 
  at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x0001d] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:203 
  at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00007] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:494 
  at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00009] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:434 
  --- End of managed exception stack trace ---
java.lang.ClassNotFoundException: Didn't find class "md5996393b23f6d276fda35c7846aecfb34.FirstView" on path: DexPathList[[zip file "/data/app/test.droid-1/base.apk"],nativeLibraryDirectories=[/data/app/test.droid-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) ...

所以,它试图找到/data/app/test.droid-1/base.apk内部的视图 - 这是加载程序集的主要项目 - 所以,当然,该类不在那里。

有人暗示我必须为此做些什么吗?

0 个答案:

没有答案