Debugging Xamarin Forms app via USB tethered Android phone - Why is constant app uninstall required?

AndyAndy Member ✭✭

I am on the latest versions of VS (15.8.3), Xamarin etc. I am debugging on a Android 8.1 OnePlus6.
I find that I constantly need to delete my xamarin app from the device in order to be able to successfully build and debug the app from within Visual Studio.
It works the first time, but as soon as I stop and restart the debugger in VS I see the app started momentarily (Blank white screen) and then it just exits.
There are no errors reported on the phone or by Visual Studio.


  • AndyAndy Member ✭✭

    I get this all the time when I start debugging in Visual Studio 2017.
    This was not happening up to about a month ago. Now I have to delete the app from the mobile device in order for debugging to work again.

    Android application is debugging.
    Couldn't connect to logcat, GetProcessId returned: 0

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Are you stopping debugging through VS? Or are you killing the app on the tablet, which ends debugging?

    I see this once in a great while and can almost always chalk it up to one of the background services we start up from within the app (we have a few listeners in the Android project) still running. If the app AND all the broadcast listeners we started, get killed then I don't see this.

    So... Is it possible you are starting up BroadcastListeners from the Android project?

  • AndyAndy Member ✭✭

    I normally stop debugging in VS (Red square button). I don't have any broadcastlisteners in the Android.
    My app is simple, SQLite DB and some REST API calls to the server.

  • AndyAndy Member ✭✭

    BTW - When I connect to my Android_accelerated_x86_Oreo emulator I have no problems. It's only when I connect to my phone

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    That might be a hint. I use Samsung tablets exclusively. Maybe its related to either OS version or devices.

  • jonpeppersjonpeppers USMember, Xamarin Team Xamurai

    Hi @Andy,

    Could you attach some logs, maybe we can figure out what is happening on your device?

    So you could try one of these options:
    Enable diagnostic logging > save to text file
    • Deploy command line such as “msbuild YourAndroidApp.csproj /t:Install /bl” > send msbuild.binlog in current directory

    Anything you could send would be helpful, thanks!

  • AndyAndy Member ✭✭

    I found the problem in the Android project "Android Options" "Use Shared Runtime" setting. I turned it off and the problem went away. I don't recall this being a problem before. I hadn't changed this recently.

Sign In or Register to comment.