Reputation: 597
I just installed the new Visual Studio for Mac, but I cannot run the standard app on an emulator. It's the "hello world" app that's created by Visual Studio itself when you create a new project. I've tried to run it using the included emulator but also Xamarin Android Player. However, for both emulators I get the following error:
"Unfortunately, app has stopped."
The emulators work fine. It's only the app that is giving problems.
I feel like I'm missing something in the manifest or something. But this is the standard app. It should work, right?
Code from main activity:
using Android.App;
using Android.Widget;
using Android.OS;
namespace Project_App3.Droid
{
[Activity(Label = "App3", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.myButton);
button.Click += delegate { button.Text = $"{count++} clicks!"; };
}
}
}
Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.test.app3">
<uses-sdk android:minSdkVersion="15" />
<application android:label="App3">
</application>
</manifest>
Application Output:
[art] Not late-enabling -Xcheck:jni (already on)
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.test.app3, PID: 5225 [AndroidRuntime] java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform! [AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:5156) [AndroidRuntime] at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748) [AndroidRuntime] at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688) [AndroidRuntime] at android.app.ActivityThread.-wrap1(ActivityThread.java) [AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) [AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:102) [AndroidRuntime] at android.os.Looper.loop(Looper.java:148) [AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5417) [AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method) [AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) [AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) [AndroidRuntime] Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform! [AndroidRuntime] at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:38) [AndroidRuntime] at android.app.ActivityThread.installProvider(ActivityThread.java:5153) [AndroidRuntime] ... 10 more [AndroidRuntime] Caused by: android.content.pm.PackageManager$NameNotFoundException: Xamarin.Android.Platform [AndroidRuntime] at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:304) [AndroidRuntime] at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:32) [AndroidRuntime] ... 11 more
Upvotes: 0
Views: 578
Reputation: 597
I found the answer using Andrius' help. I googled the runtime exceptions and I found the solution here: unable to create helloworld
I changed the target framework to Android Marshmallow
Upvotes: 1