Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crash #8

Closed
situssoft opened this issue May 25, 2018 · 9 comments
Closed

App Crash #8

situssoft opened this issue May 25, 2018 · 9 comments

Comments

@situssoft
Copy link

Hi,

I've just cloned this repo and built and run locally on both android simulator and a google pixel. In both cases the app starts and shows the splash screen then after a short delay crashes. I have not modified the code.

This is my first attempt to use Mvvmcross and Xamarin forms. All I get from the debugger is the following rather unhelpful exception.

Unhandled Exception:

System.ArgumentNullException: Value cannot be null.
Parameter name: source occurred

Can you advise how I might progress to a working solution?

@jaredballen
Copy link

@situssoft, did you ever resolve your issue with this? I am running into the same thing.

@ghost
Copy link

ghost commented Jun 5, 2018

Same thing here.

@situssoft
Copy link
Author

No, I didn't find a fix and I was unable to build the code from source control (which is a pet hate) so I've moved my project to Prism.

@rafaelnicolett
Copy link

Same problem here. Any suggestions?

@rafaelnicolett
Copy link

rafaelnicolett commented Jun 7, 2018

I discovered the solution for this problem, remove the class Setup and SplashScreen and change the MainActivity for like this:

[Activity(Label` = "Sample", Icon = "@mipmap/icon", Theme = "@style/AppTheme",
              ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
              MainLauncher = true, LaunchMode = LaunchMode.SingleTask)]
    public class MainActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<CoreApp, App>, CoreApp, App>
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
            base.OnCreate(bundle);
        }
    }

More details in TipCalc Sample

@agat366
Copy link

agat366 commented Jun 7, 2018

Unfortunately, this is quite often thing with MvvmCross these days, when it just doesn't work out-of-box. So, lots of devs just choose other frameworks.

@rafaelnicolett, this is still not ideal solution as it considers no splash screen, which is barely acceptable for most of apps.

After some investigation I've found correct way to make it work (quite weird why there is no docs about that anywhere) (hello wasted 4 hours of my time):

        public class SplashScreen : MvxFormsSplashScreenAppCompatActivity<Setup, CoreApp, App>

The only trick here is setting Theme = "@style/MainTheme" to support AppCompat one, but all that is just up to the dev how to define it then...

@rafaelnicolett
Copy link

@agat366 Great observation, I know that my solution it's bad, but it's work for hour.
Thank you for shared you solution with us. 👌

@rafaelnicolett
Copy link

rafaelnicolett commented Jun 15, 2018

@agat366 Great, it's work now perfect. Thank you 😊

@martijn00
Copy link
Member

Fixed in c464e92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants