Android、Visual Studio、Xamarin:位图在发布模式下为空,但是!=处于调试模式时为null
这就是问题所在:Android、Visual Studio、Xamarin:位图在发布模式下为空,但是!=处于调试模式时为null,android,visual-studio,Android,Visual Studio,这就是问题所在: try { if (bitmap == null) // app crashes without any error message in release { width = 100; //bitmap.Width; height = 200; //bitmap.Height; Toast.MakeText(this, "bitmap was null", ToastLength.Short).Show(); } else { width = bitma
try {
if (bitmap == null) // app crashes without any error message in release
{
width = 100; //bitmap.Width;
height = 200; //bitmap.Height;
Toast.MakeText(this, "bitmap was null", ToastLength.Short).Show();
}
else {
width = bitmap.Width;
height = bitmap.Height;
}
} catch {
Toast.MakeText(this, "bitmap was not null", ToastLength.Short).Show();
}
突然,当用户要拍照然后编辑时,我们的应用程序开始崩溃。但每当我们调试这个错误时,它就不会出现。现在,经过多次尝试,我缩小了范围。由于某些原因,当应用程序处于发布模式时,位图为空。但在调试模式下,位图返回一个对象,因此应用程序不会崩溃
同样有趣的是:应用程序崩溃,即使本应使其崩溃的代码被跳过。但安卓操作系统并没有说“应用程序崩溃”,它只是结束了应用程序。如果没有try-catch块,则不会出现与以前一样的错误消息
有人知道问题出在哪里吗
提前谢谢 只需确保您在清单中拥有所需的所有权限,甚至可能还有更多权限,以确保安全 我不知道为什么我的应用程序不能在调试模式下告诉我一些重要的权限丢失了,但是嘿,那是浪费了5个小时