【问题标题】:Xamarin Forms Linker and Prism.DryiocXamarin 形成链接器和 Prism.Dryioc
【发布时间】:2018-01-03 10:22:24
【问题描述】:

Soo,当我们使用 Xamarin Forms 时,我们想要一个小的 apk 大小。为了实现这一点,我们有 Linker 和 Proguard。

但是使用 Prism.Dryioc 我卡住了,我真的不知道如何正确设置我的 Link 配置文件。

<?xml version="1.0" encoding="utf-8" ?>
<linker>
  <assembly fullname="Prism.Forms">
      <type fullname="Prism.Common.ApplicationProvider" preserve="all" />
      <type fullname="Prism.Services.PageDialogService" preserve="all" />
      <type fullname="Prism.Services.DeviceService" preserve="all" />
  </assembly>

   <assembly fullname="Prism.DryIoc.Forms" >
      <namespace fullname="Prism.DryIoc" preserve="all" />
   </assembly>
   <assembly fullname="Prism">
      <namespace fullname="Prism.Ioc" preserve="all" />
   </assembly>
   <assembly fullname="netstandard">
      <namespace fullname="System.Reflection" preserve="all" />
      <namespace fullname="System.Xml" preserve="all" />
   </assembly>
 </linker>

上面我得到了这个例外:

01-03 17:14:04.526 I/MonoDroid(28121):未处理的异常:01-03 17:14:04.552 I/MonoDroid(28121):System.TypeInitializationException:“注册表”的类型初始化程序引发异常. ---> System.TypeInitializationException:“DryIoc.WrappersSupport”的类型初始化程序引发了异常。 ---> DryIoc.ContainerException:MethodInfo 类型的参数为空。 01-03 17:14:04.552 I/MonoDroid(28121): 在 DryIoc.Throw.ThrowIfNull[T] (T arg, System.Int32 错误, System.Object arg0, System.Object arg1, System.Object arg2, System.对象 arg3) [0x0002b] 在:0 01-03 17:14:04.552 I/MonoDroid(28121):在 DryIoc.WrappersSupport..cctor () [0x0013e] 在:0 01-03 17:14:04.552 I/MonoDroid (28121):---内部异常堆栈跟踪结束---01-03 17:14:04.552 I/MonoDroid(28121):---内部异常堆栈跟踪结束---01-03 17:14: 04.552 I/MonoDroid(28121): 在 Prism.DryIoc.PrismApplication.CreateContainer () [0x00006] in :0 01-03 17:14:04.552 I/MonoDroid(28121)[T].Base初始化 () [0x0001e] in :0

01-03 17:14:04.552 I/MonoDroid(28121): 在 Prism.PrismApplicationBase1[T].InitializeInternal () [0x00006] in :0 01-03 17:14:04.552 I/MonoDroid(28121):在 Prism.PrismApplicationBase1[T]..ctor(Prism.IPlatformInitializer1[T] 初始化程序)[0x00031] 在:0 01-03 17:14:04.552 I/MonoDroid(28121):在 Prism.DryIoc.PrismApplication.set_ModuleCatalog(Prism .Modularity.IModuleCatalog value) [0x00000] in :0 01-03 17:14:04.552 I/MonoDroid(28121): at Mobile.App..ctor (Prism.DryIoc.IPlatformInitializer initializer) [0x0000] :\Projetos\ECS_APP\Mobile\Mobile\App.xaml.cs:33 01-03 17:14:04.552 I/MonoDroid(28121): 在 Mobile.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x000b2 ] 在 C:\Projetos\ECS_APP\Mobile\Mobile.Android\MainActivity.cs:41 01-03 17:14:04.552 I/MonoDroid(28121): 在 Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (系统。 IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] 在:0 01-03 17:14:04.552 I/MonoDroid(28121): at (wrapper dynamic-method) System.Object:8b2e8b21-fb7e-4a04-a143-a1dc11f69d85 (intptr,intptr,intpt) 17:14:04.577 W/art (28121):JNI RegisterNativeMethods:尝试为 android.runtime.JavaProxyThrowable 注册 0 个本机方法发生未处理的异常。

有人可以帮我找到使链接器工作的方法吗?

【问题讨论】:

    标签: xamarin optimization xamarin.forms dryioc


    【解决方案1】:

    我的链接器文件非常错误。我在几个小时后修复了。

    ?xml version="1.0" encoding="utf-8" ?>
    <linker>
    
    <assembly fullname="SQLite-net">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="SQLitePCLRaw.batteries_v2">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="SQLitePCLRaw.core">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="DryIoc">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="System">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="mscorlib">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="Prism">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="Prism.DryIoc.Forms">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="MyProjectPCL">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="Prism.Forms">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="Plugin.Permissions">
      <type fullname="*" />
    </assembly>
    
    <assembly fullname="Xamarin.Forms.Maps">
      <type fullname="*" />
    </assembly>
    
     <assembly fullname="Newtonsoft.Json">
       <type fullname="*" />
    </assembly>
    
    </linker>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-29
      • 1970-01-01
      • 2019-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多