All components are up to date, so is Visual Studio.
I created a new project:
When I start it with the emulators, everything works fine. When I start it with the live player and my Sony Xperia Compact 5, it connects nicely, but the Android code in MainActivity is not used.
Only one modification I made, I write to the trace. The breakpoint is also never hit, unless I use an emulator instead.
using System;
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App5KittyOp.Droid
{
[Activity(Label = "App5KittyOp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
System.Diagnostics.Debug.WriteLine("In OnCreate");
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
}
The dependency injection which I added from the beginners tutorial, also worked fine. So, the code in the Android project is used, except the MainActivity.
I have been programming ASP.net since the 90s but I am new to xamarin. Any help would be apreciated.