问题描述
最近,我的Xamarin.Android应用在启动时开始崩溃,原因是:
Recently, my Xamarin.Android app has started to crash on launch, caused by:
此异常的发生频率很高.通常,重新构建可以解决一两个构建问题.我试图通过制作自己的应用程序类来解决该问题:
This exception is being thrown more often than not. Usually, a rebuild fixes the issue for a build or two. I tried to combat the issue by making my own application class:
[Application(AllowBackup = true, Debuggable = true, Label = "My Application",
Theme = "@style/AppBaseTheme", Icon = "@drawable/icon", Logo = "@drawable/icon")]
[MetaData("com.google.android.gms.version", Value = "@integer/google_play_services_version"),
MetaData("com.google.android.geo.API_KEY", Value = "[redacted]")]
public class MyApplication: Application {
public MyApplication(IntPtr handle, JniHandleOwnership ownership) : base(handle, ownership) {
}
public override void OnCreate() {
base.OnCreate();
}
}
不幸的是,发生相同的异常(除了因为找不到我的类而不是Mono的类而感到沮丧).各种Google搜索,Xamarin论坛主题和StackOverflow问题并没有太大帮助(实际上,重建和创建自定义应用程序类的想法来自于此).这个问题确实很烦人,这让我很难调试我的应用程序.难道我做错了什么?我该如何解决?
Unfortunately, the same exception occurs (except that it's upset about not finding my class, instead of Mono's). Various Google searches, Xamarin Forums threads, and StackOverflow questions haven't helped a whole lot (in fact, the ideas to rebuild and make a custom application class came from that). This issue is really annoying and it is making it hard for me to debug my app. Am I doing something wrong? How can I fix this?
推荐答案
我做了些麻烦,我在项目的设置中关闭了共享的Mono运行时,这似乎已经解决了问题(至少到目前为止).如果问题不再起作用,我将进行更新.
I did some messing around and I turned off the shared Mono runtime in my project's settings, and that seems to have solved the problem (for now at least). I'll update the question if it stops working again.
这篇关于我的Xamarin.Android应用有时会在启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!