在Xamarin表单中打开初始屏幕后,应用程序崩溃

时间:2018-11-26 07:06:30

标签: xamarin xamarin.forms

这是我的初始屏幕活动

Tue Oct 17 2017,8:01p,Boston Celtics,99,Cleveland Cavaliers,102,
Tue Oct 17 2017,10:30p,Houston Rockets,122,Golden State Warriors,121,
Wed Oct 18 2017,7:30p,Milwaukee Bucks,108,Boston Celtics,100,

曲棍球应用无法发送此问题的崩溃报告 这是曲棍球应用崩溃报告的代码,位于MainActivity内部

[Activity(Label = "MyActivity", Icon = "@drawable/AppLogo", Theme = "@style/SplashTheme",
           MainLauncher = false,ScreenOrientation =ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class splashScreen : Activity
    {
        protected override void OnCreate(Bundle saveInstanceState)
        {
            base.OnCreate(saveInstanceState);
            var mainActivityIntent = new Intent(this, typeof(MainActivity));
            StartActivity(mainActivityIntent);           
        }

    }

这在少数设备上发生,而不是在所有设备上发生。 如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

OnCreate子类的Android.App.Application中注册崩溃报告程序。

应用示例:

#if DEBUG
    [Application(AllowBackup = false, Debuggable = true)]
#else
    [Application(AllowBackup = true, Debuggable = false)]
#endif
    public class App : Application
    {
        public override void OnCreate()
        {
            base.OnCreate();
            CrashManager.Register(this, "~~~");
        }
    }