首页 文章

Xamarin Forms PCL中的LoadApplication出错

提问于
浏览
4

我创建了一个新的 Xamarin Forms PCL 解决方案,在调试模式下,我检查了 Enable ProGuard 选项,并选择 Linking comboxbox为 Sdk and User Assemblies . 现在我在android上运行我的应用程序,之后它在MainActivity.cs类和在线显示我的错误

LoadApplication(new App());

错误:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.

我这样做是因为减少了我的发布应用程序的大小,我必须将发布模式更改为调试以检查发生了什么 .

2 回答

  • 2

    根据:The type or namespace 'App' does not exist in the current namespace

    清理解决方案构建PCL从受影响的项目中删除PCL参考重新添加PCL参考Build

    我试过这个解决方案,但它确实有效

  • 0

    看看你的App.xaml.cs文件 . 如果您在当前上下文错误中存在“InitializeComponent”,则可能是由已知的VS错误引起的 .

    解决方案:

    • 右键单击App.xaml.cs并选择“属性” .

    • 将构建操作更改为"Content" .

    • 申请 .

    • 将构建操作更改回C#编译器 .

    • 清洁解决方案 .

    • 构建和部署 .

相关问题