简体   繁体   中英

Android emulator not working with visual studio

I am pretty new to xamarin , Just tried to implement Hello world on button click . In my .axml file i created button and in .cs file i have written logic to say hello world on button click. when i try to run the application by selecting the android emulator from the provided list of emulators, first application says deploying after that it is going to debug mode though i didn't give any break point, from debug mode it is launching the emulator and program goes out of execution . when i checked the apps in emulator i cant see my application in that . I tried a solution in the forum which says to start the emulator again while it's running but this time i can see my application opening up but with in seconds it says "unfortunately application is closed". Tried to uncheck the fast deploying option but no use. Can any one help me in this .

protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        // SetContentView (Resource.Layout.Main);
        Button myButton = FindViewById<Button>(Resource.Id.btnHw);
        myButton.Click += myButton_Clcik;
    }

    void myButton_Clcik(object sender, EventArgs e)
    {
        Toast.MakeText(this, "Hello world", ToastLength.Long).Show();
    }



}

Thank you.

Its because the missing libaot-mscorlib.dll. so, which is usually hidden in a plethora of messages - is easy to fix: disable Android fast deployment. Go to the properties of the Android project, hit tab “Android options”, and unselect “Use Fast Deployment”.

If this doesnot work, do these following steps:

  1. Start the Hyper-V manager
  2. Select the emulator you are trying to use
  3. Right-click, hit settings
  4. Click processor
  5. Click Compatibility
  6. Click checkbox “Migrate to a physical computer with a different processor version”

Read the article, i guess it will help https://dzone.com/articles/fix-for-could-not-connect-to-the-debugger-while-de

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM