【发布时间】:2018-08-11 10:18:50
【问题描述】:
我创建了一个新的Xamarin Forms PCL 解决方案,在调试模式下,我检查了Enable ProGuard 选项并选择了Linking 组合框到Sdk and User Assemblies。
现在我在 android 上运行我的应用程序,之后它在 MainActivity.cs 类和在线显示我一个错误
LoadApplication(new App());
错误:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
我这样做是为了减小发布应用程序的大小,并且我必须将发布模式更改为调试以检查发生了什么。
【问题讨论】:
-
我假设您使用的是 Xamarin 表单?请发布引发错误的代码行。我认为您的问题是您需要将其更改为
LoadApplication(new PCLNameHere.App()) -
我试过了,但它在 LoadApplication(new App());重要的一点是,当我将 Linking 选项更改为 none 并且未选中 ProGuard 选项时,我的应用程序成功运行。我需要这些选项来减少我的最终 .apk 文件
-
堆栈跟踪的其余部分是什么意思?
-
仅链接 SDK 程序集还不够?
-
@hvaughan3 我的 Environment.StackTrace 的值是:在 System.Environment.get_StackTrace () [0x00000] in :0 在 System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception) [ 0x00000]在:0在System.Diagnostics.Debugger.Mono_UnhandledException(System.Exception的前)[0x00000]在:0在System.Object.d09f62bf-1e4f-438B-810E-1b2febfe5330(System.IntPtr, System.IntPtr , System.IntPtr ) [0x00000] 在 :0
标签: c# android xamarin portable-class-library