Xamarin with Java.Lang.RuntimeException error: Unable to start activity ComponentInfo

1

I'm doing a very simple project and I have the following error:

  

Java.Lang.RuntimeException: Unable to start activity   ComponentInfo {ProjectName / md5688 ..... SplashActivity}:   android.view.InflateException: Binary XML file line # 14: Binary XML   file line # 14: Error inflating class   android.support.v7.widget.FitWindowsLinearLayout

First load a SplashActivity a couple of seconds and then the MainActivity, I leave the code:

  

SplashActivity.cs

namespace SKVservice.Droid
{
    [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
    public class SplashActivity : AppCompatActivity
    {
        static readonly string TAG = "X:" + typeof(SplashActivity).Name;

        public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
        {
            base.OnCreate(savedInstanceState, persistentState);
            Log.Debug(TAG, "SplashActivity.OnCreate");
        }

        // Launches the startup task
        protected override void OnResume()
        {
            base.OnResume();
            Task startupWork = new Task(() => { SimulateStartup(); });
            startupWork.Start();
        }

        // Simulates background work that happens behind the splash screen
        async void SimulateStartup()
        {
            Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
            await Task.Delay(2000); // Simulate a bit of startup work.
            Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
            StartActivity(new Intent(Application.Context, typeof(MainActivity)));
        }
    }
}
  

MainActivity.cs

    namespace SKVservice.Droid
{
    [Activity(Label = "SKVservice", Icon = "@mipmap/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
    }
}

I would appreciate a help thanks.

    
asked by Fran Pino 23.10.2018 в 12:34
source

0 answers