I am trying to create a simple app in Xamarin Android with Xamarin Forms using Visual Studio, however I keep getting this error everytime I try to build. I have double checked my references which should contain the Portable project, as well as made sure I have the latest version of Xamarin.Forms. What could I still be missing that would give this error?
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using App2;
using Xamarin.Forms.Platform.Android;
namespace App2.Droid
{
[Activity(Label = "App2", Icon = "@drawable/icon", MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity :
global::Xamarin.Forms.Platform.Android.FormsApplicationActivity // superclass new in 1.3
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App()); // method is new in 1.3
}
}
}
In my case, I found there is a bug with Visual Studio 2017 when making a cross platform Xamarin Form app with the generated code if there is a dash in the filename.
It looks like it tries to snake case the title and then complains about not finding that file.
For example, for "my-project", it starts looking for "my_project" in some areas of the generated code.
Using a project name with no symbols seems to solve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With