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
Related
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:
My Xamarin Forms App works fine in Android devices, but when trying do deploy on a real iOS device it crashes after the splash screen, I said real because I can run without any problem on the simulator.
I try to debug the App on a real iOS device, and I found that the crash happen when the App try to load the XAML file on:
private void InitializeComponent() {
global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(LoginPage));
Please take a look at the debug steps:
Regards,
Pedro
I found the problem. The [XamlCompilation(XamlCompilationOptions.Compile)] was missing on the code behind C# file, and because of that some methods used by click events of controls on the XAML were not available. But still can't find explanation for this not happening on the simulator!
In case it is a help to anyone, I had the same symptom for a different reason. I am using single page simple navigation in the app in question setting MainPage to the current page in the app. After few days of troubleshooting, happened to notice the checkbox in Application section of info.plist, "Supports Multiple Windows" was checked. Unchecking this restored my app to working condition. There were no diagnostic messages that seemed related, just a crash after splash in release mode, and a black screen in debug mode.
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...
When I tried to run any sample application or a new one it shows this error. Can anyone help please?
The error is telling you that you have not selected a device:
"Please select a valid device before running the application"
You need to choice a physical phone (or Android emulator) to deploy the application to.
Ref: Debug on Device
you have to have the android virtual device downloaded.
here are a few options:
Xamarin Android player
Bluestacks
Andy
Genymotion
Now that you have the virtual device. you need to start one before you run or debug.
The specific error you are seeing is because you've not started the device properly before you debug, you should be able to see the device.
Now run the project, and you wont meet this error.
This is because of Hyper V. Things you need to do are:
1.Turn off your Hyper V.(http://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/)
2.Update your android SDK to desired platform.
That set. Now run your app. It will work.
Please let me know if still you have same error.
I would advise you to use the Visual Studio Emulator for Android (get it here), it plays very nice with Xamarin and Visual Studio and sets up your system automatically. As an added benefit it is very fast!
How can open debug mode when application is running on android studio.,
My application is appearing on -Android Device Monitor- Devices tab . When i clicked application line on this screen ,debug icon is not active
How can i pass to debug mode after running my application?
In Android Studio (I'm currently using I/O Preview 0.2.10) simply click on the icon in the toolbar that looks like a phone with a bug over it - the hover text says: Attach debugger to Android process. It's the third icon along:
A list will then appear showing your processes that you can debug. Choose one and select OK - your application is now being debugged!
Note: Make sure your app is debuggable, as shown here.
Main Menu Toolbar -> Attach Debugger to Android Process
//or
Run -> Attach Debugger to Android Process
Icon looks like
One more interesting feature is Attach Debugger when app is starting(using Run or open/reopen on device)
Developer options -> Select debug app
Developer options -> Wait for debugger