locked
Debugging on Android not working RRS feed

  • Question

  • User361121 posted

    When I run my project in Debug on Android, it deploys (on emulator), I get no errors or messages that indicate an issue, but it just stops and is no longer running. I created a new empty XF project and it runs OK on debug mode and not stops after deployment. I already tried : * Updating Visual Studio to latest version * Updating XF to latest version (4.3) * Reinstalling all Nuget packages * Checked Deploy of Android project in solution configuration * Checked x86 abi * The debugger is Xamarin * Checking all settings in Android and .Net Standard project to be the same as the project that runs in debug mode properly (I tried almost all different available combinations of settings!) * Deleting bin and obj folders, cleaning, restarting vs and rebuilding projects

    What is the problem of this project? Is it a bug?

    Sunday, December 8, 2019 8:22 PM

Answers

  • User40046 posted

    Check your Andoid csproj file location. It needs to be one level lower than the .sln file. Android will disconnect when debugging if it is located in another location.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, December 9, 2019 2:05 PM
  • User361121 posted

    Thank you @LyndonHughey I created a new solution two levels upper than Android csproj and now I can debug! C:\TFSSayba\Sayba\Projects\Mobile\Xamarin\Release1\Sayba.Xamarin.sln C:\TFSSayba\Sayba\Projects\Mobile\Xamarin\Release1\Sayba.Xamarin\Sayba.Xamarin.Android\Sayba.Xamarin.Android.csproj I changed one level lower (as @LyndonHughey said) to two levels lower because when I create a new Mobile App (XF) from default templates of VS, It makes directories like that (csproj two levels lower than sln) Finally I ask this question again, Why is Xamarin Forms so tricky and unstable, Where is the documentation that says you should put your Android project two levels lower than sln and why?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, December 10, 2019 5:41 AM

All replies

  • User382871 posted

    When I run my project in Debug on Android ... but it just stops and is no longer running...a new empty XF project runs OK 1.Did this occur on all emulators? Try to test the sample on another emulator or a read device. 2.Try to create a new project, move the code to the project and try again.

    Monday, December 9, 2019 6:06 AM
  • User185808 posted

    Try enabling Diagnostic logging in Visual Studio.

    Examine the output, maybe you can something in there.

    Another question, does it deploy and debug successfully on an iOs simulator ?

    Monday, December 9, 2019 7:34 AM
  • User361121 posted

    Thanks @Jarvan and @MarcDieters

    1.Did this occur on all emulators? Try to test the sample on another emulator or a read device.

    Yes it occurs on different emulators and Android device (Samsung A50 - Pie)

    2.Try to create a new project, move the code to the project and try again.

    I created a new project, moved files form old project to new one, added Nugets and refrences and ... , same problem again!

    Try enabling Diagnostic logging in Visual Studio.

    I changed output to "diagnostinc", I didn't understand anything special from the output, output file is attached

    Another question, does it deploy and debug successfully on an iOs simulator ?

    Yes, I can deploy and debug on iOS without any problem

    Monday, December 9, 2019 12:34 PM
  • User40046 posted

    Check your Andoid csproj file location. It needs to be one level lower than the .sln file. Android will disconnect when debugging if it is located in another location.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, December 9, 2019 2:05 PM
  • User361121 posted

    Thank you @LyndonHughey I created a new solution two levels upper than Android csproj and now I can debug! C:\TFSSayba\Sayba\Projects\Mobile\Xamarin\Release1\Sayba.Xamarin.sln C:\TFSSayba\Sayba\Projects\Mobile\Xamarin\Release1\Sayba.Xamarin\Sayba.Xamarin.Android\Sayba.Xamarin.Android.csproj I changed one level lower (as @LyndonHughey said) to two levels lower because when I create a new Mobile App (XF) from default templates of VS, It makes directories like that (csproj two levels lower than sln) Finally I ask this question again, Why is Xamarin Forms so tricky and unstable, Where is the documentation that says you should put your Android project two levels lower than sln and why?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, December 10, 2019 5:41 AM
  • User40046 posted

    @ShahramShobeiri This a bug. I've opened an issue at https://github.com/xamarin/Xamarin.Forms/issues/8883.

    Friday, December 13, 2019 1:53 PM
  • User395124 posted

    Simple, Project options -> Android Build -> Enable 'Use Shared Mono Runtime'

    Wednesday, June 10, 2020 5:31 AM