3

我在发布模式下的 Xamarin Forms 应用程序(适用于 Android)的大小为 39 Mb。我启用了“链接所有程序集”选项。我阅读了有关此选项的信息,并且知道这很困难。但大路从第一步开始。我有这个例外:

10-30 20:25:18.895 I/MonoDroid(12805): UNHANDLED EXCEPTION:
Thread started: <Thread Pool> #9
10-30 20:25:19.023 I/MonoDroid(12805): System.NullReferenceException: Object reference not set to an instance of an object.
10-30 20:25:19.023 I/MonoDroid(12805):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage (Xamarin.Forms.Page page, System.Int32 width, System.Int32 height) [0x00034] in <375f0348c53348fdb7c0a424087b45cb>:0 
10-30 20:25:19.023 I/MonoDroid(12805):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0000a] in <375f0348c53348fdb7c0a424087b45cb>:0 
10-30 20:25:19.023 I/MonoDroid(12805):   at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00018] in <375f0348c53348fdb7c0a424087b45cb>:0 
10-30 20:25:19.023 I/MonoDroid(12805):   at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00008] in <241e52499950417a9f098f3fc184c7de>:0 
10-30 20:25:19.023 I/MonoDroid(12805):   at (wrapper dynamic-method) System.Object:28e70870-796b-47c6-a7d7-29a2619bac5a (intptr,intptr,bool,int,int,int,int)
10-30 20:25:19.066 W/art     (12805): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

我在我的项目中添加了这个文件(Build Action to LinkDescription):

<linker>
  <assembly fullname="Xamarin.Forms.Platform.Android">
    <type fullname="Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage">
      <method name=".ctor" />
    </type>
  </assembly>
</linker>

但我有同样的例外。我在我的 csproj 中添加了这个项目:

 <PropertyGroup>
    <AndroidLinkSkip>Xamarin.Android.Support.v7.AppCompat;Xamarin.Forms.Platform.Android</AndroidLinkSkip>
</PropertyGroup>

但我有同样的例外。有任何想法吗?

4

0 回答 0