erotavlas
erotavlas

Reputation: 4485

System.InvalidOperationException: PushAsync is not supported globally on Android

I'm following this Xamarin Forms quick start guide (the one for multiscreen)

BUT I get this error when I try to run the completed program

System.InvalidOperationException: PushAsync is not supported globally on Android, please use a NavigationPage

There is no option to add a 'NavigationPage' to the shared library project.

Any ideas? I'm using Visual Studio 15.5.2 and latest version of everything including Windows 10.

NOTE: in this guide the step 4 no longer matches with Visual studio enter image description here

There is no longer Cross-Platform > Forms Xaml Page, instead it has been replaced with these options

enter image description here

Upvotes: 2

Views: 3644

Answers (2)

Shiwanka Chathuranga
Shiwanka Chathuranga

Reputation: 889

Their nothing to do with versions, I think you miss some basics of navigations...

You have to have Navigation at first like this in App.cs

MainPage = new NavigationPage(new MyContentPage());

Upvotes: 1

SushiHangover
SushiHangover

Reputation: 74124

In your Application subclass (normally in the App.cs or App.xaml.cs file if created by template), wrap your first page within a NavigationPage page and now you will be able to push and pop pages.

Sample:

MainPage = new YourFirstPage(); 

Wrap it in a NavigationPage

MainPage = new NavigationPage(new YourFirstPage());

Upvotes: 4

Related Questions