App only runs intermittently in Android Emulator

Mayur534Mayur534 Member ✭✭
edited September 2018 in Xamarin.Android

I create an AVD using Android Studio and try to run my Xamarin Android app from VS 2017. But most of the times, the app builds, deploys, but it does not run in the emulator. The emulator error says "app.Android has stopped working" and the console says "Android application is debugging".

I have to always go and create a new AVD and clean the project, re build and run again. This will get it working sometimes but i do not understand this intermittent behaviour, plus it is very time consuming. Is it because of the AVD, Xamarin, or Android Properties ? Can anyone please suggest me a permanent solution to avoid this ?Thank you.

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    @Mayur534
    You may try the following methods:

    1.right-click on the Android project > Properties > Android Option > Deselect "Use Fast Deployment" from the Packaging tab > Save
    2.if not work, .Go to the Project Properties -> Build; Verify if you have a Platform Target and Platform .If not, customize one Platform Target for the entire solution: x86 or x64;
    3.If it is still not work, try to access regedit.exe, navigating to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android, and changing the SDK path to my Xamarin Mono Android SDK folder.
    Example: The path originally is C:\Users[User]\AppData\Local\Android\android-sdk then change to C:\Users[User]\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK
    For more details :
    https://forums.xamarin.com/discussion/64088/android-emulator-opens-but-project-does-not-deploy-and-start

    https://forums.xamarin.com/discussion/comment/207120#Comment_207120

    If you don't get it to work at the end, please collect the detail logs of your Emulator and post us,that would be really appreciated!

  • Mayur534Mayur534 Member ✭✭

    Thank you for your answer. I tried all the things you mentioned, and it works sometimes but still it does not work most of the times. This is the error that i get all the time: -

    10-03 14:52:18.298: E/AndroidRuntime(22048): Caused by: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider" on path: DexPathList[[zip file "/data/app/com.companyname.AppName-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.AppName-1/lib/arm, /data/app/com.companyname.AppName-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
    10-03 14:52:18.298: E/AndroidRuntime(22048):
    
Sign In or Register to comment.