我的Xamarin.Android应用有时会在启动时崩溃 [英] My Xamarin.Android app sometimes crashes on launch

查看:104
本文介绍了我的Xamarin.Android应用有时会在启动时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我的Xamarin.Android应用在启动时开始崩溃,原因是:

Recently, my Xamarin.Android app has started to crash on launch, caused by:

Java.Lang.ClassNotFoundException:mono.android.app.Application

Java.Lang.ClassNotFoundException: mono.android.app.Application

此异常的发生频率很高.通常,重新构建可以解决一两个构建问题.我试图通过制作自己的应用程序类来解决该问题:

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应用有时会在启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆