Xamarin Android | UI shows up blank in device - visual-studio

I'm developing android app for learning purpose. I've installed Xamarin 4.2.1.60 on my laptop.
I created a simple Layout and tried to run it on my One Plus 3 (Android M 6.0.1) and Moto G (Android L 5.1) 1st Gen
but the layout shows up empty in both of them.
It also gives me a below Exception on running:
Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object.
On pressing break, a window open in Visual Studio with Header saying Source Not Available
(Please see attached screenshots)
Please suggest how can I resolve this.
Designer Screen:
Device Screen:
Exception Window:

Make sure to set a default SetContentView() in your MainActivity.OnCreate() with a valid Android layout.

Related

Xamarin Forms Android app fails on launch: Can't detect when [class] is activated/deactivated..implement IActivationForViewFetcher

As the title says this is the error from the device log when launching a Xamarin forms android app in release mode on Android Q. This occurs on a release device only.
System.ArgumentException: Don't know how to detect when [launcher class] is activated/deactivated, you may need to implement IActivationForViewFetcher
Any ideas why?
My linker settings are shown in the image:

Google Sign-In for iOS using Xamarin throws exception logs point to podfile

Trying to implement the Google Sign-In for IOS in a Xamarin project. Right on the Google page where it generates your GoogleService-Info.plist file, it says, "Insure you have CocoaPods installed and configured for your project. In you Podfile, include the following: pod 'Google/SignIn'".
And sure enough, the log on the Mac shows a similar error when going through the initial configuration.
But, I can't find anything that really tells me how to add a "Podfile" to a Xamarin IOS project (from within Visual Studio 2017, running on Windows 10).
So, when it comes time to actually click the Sign-In with Google button, in an IOS 10.3 IPhone 6 simulator, it throws an exception,
"Foundation.MonoTouchException: Objective-C exception thrown. Name:
NSInvalidArgumentException Reason: -[__NSCFString
countByEnumeratingWithState:objects:count:]: unrecognized selector
sent to instance 0x608000047200".
I can only hope it is really because of a missing component that the Podfile is supposed to resolve.
Saw a sample from a year ago that supposedly worked, but with what seems to be current right now, I can't get it to.
Update:
The sample I am trying to use, creates a custom class for the View so it can implement a custom Renderer, and a custom class for the page, again, so it can implement a custom Renderer. The View Renderer simply does:
signInButton = new SignInButton();
signInButton.Style = ButtonStyle.Wide;
signInButton.ColorScheme = ButtonColorScheme.Dark;
SetNativeControl(signInButton);
The Google button shows up, but when you click, you get the exception listed above.
A recent update to Xamarin required an update to XCode. With the update to XCode 9,the problem went away, and Google authorization is working.

xamarin studio - android emulator not launching application

I am trying to launch a simple application with some labels and images on the content page, but when the android emulator starts it opens the application and shows only a white page with nothing on it. However, if I run the iOS simulator it shows the label and images. So I wonder if there is something that is preventing the page from loading? I am using Xamarin Forms in Studio on Mac.
Can you try it in a fisical device ?
Just to know if your emulator has an error...
Are you sure you have an StackLayout or another container for the label and entry ?
Hope you solve it...

In Appcelerator mobile SDK5.0.0.GA , Android App can't normal open

I have a question, I put the Titanium SDK by 4.0.0.GA Upgrade to 5.0.0.GA, build the android app, operation is this: after entering the app, press the back button to exit the app, and then click on the desktop icon, but stuck in Titanium welcome screen.Appc version is 5.5.0.Who know what's the problem?please.
(My English is not very good)
I have find the problem. In the tiapp.xml file,changed the run - on - the main - thread has a value of false.

Xamarin.Forms - Debug.WriteLine() - where does the output go?

I have a simple Xamarin.Forms project that I'm running in Visual Studio, using an iphone emulator. I have the following code in App.cs:
protected override void OnStart()
{
Debug.WriteLine("---------- OnStart called!");
}
Where exactly is that supposed to output to? I don't see it in any of the Visual Studio output windows (Build, Build Order, Debug, Xamarin, Xamarin Diagnostics).
Using Console.WriteLine() works with Device Log. Also you can filter out all device log with mono-stdout tag.
It should be on the device log, for example on Android you can use the Android Device Monitor to see the message, You can always use Console.Writeline() to see those messages on the debug console.
It will be coming in application output window. if it is not open automatically, you can go to view -> Pads -> Application Output. This was about mac visual studio. i am not sure about windows.
Rider has a plugin called Logcat, when I write
Console.WriteLine("**** Hi mate");
, then I can filter the Logcat window for **** and it will show the Console.WriteLine's
This is in Xamarin Forms, for both iOS and Android

Resources