Abdul Manaf
Abdul Manaf

Reputation: 4993

Xamarin Android application closed unexpectedly

i'm tried to create android application using xamarin studio. iam install xamarin studio and create a new android application. the application successfully run on emulator. but after installing apk in my android phone, when open application i got the message "Unfortunately Application has stopped" . project target version is 4.03. emulator android version is 4.03 and my phone os version also 4.03. what is the actual problem. iam a buginner in xamarin studio. any idea??

this is the device log

09-01 19:12:46.654: E/AndroidRuntime(22866): FATAL EXCEPTION: main
09-01 19:12:46.654: E/AndroidRuntime(22866):  Process:com.gadgeon.helloworld, PID: 22866
09-01 19:12:46.654: E/AndroidRuntime(22866):   java.lang.RuntimeException:  Unable to get provider   mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_15 or Xamarin.Android.Platform!
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.installProvider(ActivityThread.java:5002)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.access$1500(ActivityThread.java:151)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.os.Handler.dispatchMessage(Handler.java:102)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.os.Looper.loop(Looper.java:135)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.main(ActivityThread.java:5254)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at java.lang.reflect.Method.invoke(Native Method)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at java.lang.reflect.Method.invoke(Method.java:372)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
09-01 19:12:46.654: E/AndroidRuntime(22866): Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_15 or Xamarin.Android.Platform!
09-01 19:12:46.654: E/AndroidRuntime(22866):  at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:38)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
09-01 19:12:46.654: E/AndroidRuntime(22866):  ... 11 more
09-01 19:12:46.654: E/AndroidRuntime(22866): Caused by: android.content.pm.PackageManager$NameNotFoundException: Xamarin.Android.Platform
09-01 19:12:46.654: E/AndroidRuntime(22866):  at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:281)
09-01 19:12:46.654: E/AndroidRuntime(22866):  at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:32)

Upvotes: 3

Views: 2193

Answers (2)

Abdul Manaf
Abdul Manaf

Reputation: 4993

Issue solved.

Cannot take an .apk file created in debug mode.

  1. Build project using Release mode.
  2. select Build > Archive for Publishing

This will produce a final apk file. we can install and use this apk file without any problems.

Read more about here: http://docs.xamarin.com/guides/android/getting_started/installation/set_up_device_for_development

Upvotes: 2

SushiHangover
SushiHangover

Reputation: 74094

Edit your .csproj,

Change:

<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>

To:

<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>

Then clean, rebuild and reinstall the apk

Upvotes: 1

Related Questions