Soo, when we use Xamarin Forms, we want a small apk size. To achieve that we have Linker and Proguard.
But using Prism.Dryioc I got stuck, I really don't know how to properly setup my Link configuration file.
<?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>
With the above I got this exception:
01-03 17:14:04.526 I/MonoDroid(28121): UNHANDLED EXCEPTION: 01-03 17:14:04.552 I/MonoDroid(28121): System.TypeInitializationException: The type initializer for 'Registry' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.WrappersSupport' threw an exception. ---> DryIoc.ContainerException: Argument of type MethodInfo is null. 01-03 17:14:04.552 I/MonoDroid(28121): at DryIoc.Throw.ThrowIfNull[T] (T arg, System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x0002b] in :0 01-03 17:14:04.552 I/MonoDroid(28121): at DryIoc.WrappersSupport..cctor () [0x0013e] in :0 01-03 17:14:04.552 I/MonoDroid(28121): --- End of inner exception stack trace --- 01-03 17:14:04.552 I/MonoDroid(28121): --- End of inner exception stack trace --- 01-03 17:14:04.552 I/MonoDroid(28121): at Prism.DryIoc.PrismApplication.CreateContainer () [0x00006] in <5381f1aa51c04a43a2c056545e4b1214>:0 01-03 17:14:04.552 I/MonoDroid(28121): at Prism.PrismApplicationBase1[T].Initialize () [0x0001e] in :0
01-03 17:14:04.552 I/MonoDroid(28121): at Prism.PrismApplicationBase1[T].InitializeInternal () [0x00006] in :0 01-03 17:14:04.552 I/MonoDroid(28121): at Prism.PrismApplicationBase1[T]..ctor (Prism.IPlatformInitializer1[T] initializer) [0x00031] in :0 01-03 17:14:04.552 I/MonoDroid(28121): at Prism.DryIoc.PrismApplication.set_ModuleCatalog (Prism.Modularity.IModuleCatalog value) [0x00000] in <5381f1aa51c04a43a2c056545e4b1214>:0 01-03 17:14:04.552 I/MonoDroid(28121): at Mobile.App..ctor (Prism.DryIoc.IPlatformInitializer initializer) [0x00000] in C:\Projetos\ECS_APP\Mobile\Mobile\App.xaml.cs:33 01-03 17:14:04.552 I/MonoDroid(28121): at Mobile.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x000b2] in C:\Projetos\ECS_APP\Mobile\Mobile.Android\MainActivity.cs:41 01-03 17:14:04.552 I/MonoDroid(28121): at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <0c9457d7bcf04178944f1369257ca37d>:0 01-03 17:14:04.552 I/MonoDroid(28121): at (wrapper dynamic-method) System.Object:8b2e8b21-fb7e-4a04-a143-a1dc11f69d85 (intptr,intptr,intptr) 01-03 17:14:04.577 W/art (28121): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable An unhandled exception occured.
Can someone help me to find the way to make the Linker work?