8

I am having issue debugging Android project. I can deploy to device and run it, all works fine but if I try to debug, the app gets deployed to the device and very briefly opened, splash screen shows up but the app then closes.

I am using Xamarin Forms on Visual Studio 2015.

Device is running Android Oreo (8.0.0). Another device running Android 6.0.1 is debugging fine.

The output shows following:

InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(11): Constructed
Android application is debugging.
InspectorDebugSession(11): HandleTargetEvent: TargetExited
InspectorDebugSession(11): Disposed
Couldn't connect to logcat, GetProcessId returned: 0

I checked Logcat and it seem to be having issues finding FFImageLoading library:

Time    Device Name Type    PID Tag Message
09-18 14:35:52.361  Huawei Nexus 6P Debug   1560    Mono    AOT: 
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so' 
not found: dlopen failed: library "/data/app/myapp.android.dev-
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found

I have added Nuget package for FFImageLoading to my projects and Droid project references show it as in image below:

enter image description here

pixel
  • 9,653
  • 16
  • 82
  • 149

5 Answers5

14

This worked for me :-

Deselecting the 'Use Shared Runtime' in Project Properties > Android Options > Packaging properties

Prateek Gupta
  • 880
  • 1
  • 10
  • 21
  • 2
    this makes no sense. it is to make debugging faster. it is not a permanent solution – Emil Dec 22 '18 at 14:00
7

I also had this issue with Android 8.1 and Visual Studio 2017 15.7.4.

There are three steps to got it working again.

  1. Under Android Options, go to Advanced and add your device architecture, in my case it was x86_64.
  2. Go to Tools -> Options -> Xamarin > Android Settings and enable: Provide debug symbols for shared runtime and base class libraries.
  3. And the final step is to delete following Apps from your device:

    • All Xamarin.Android API Support libraries
    • Mono Shared Runtime
    • Your App

After these steps you don't need to disable "Use Shared Runtime" and can Deploy and Debug much faster.

Essex
  • 71
  • 1
  • 3
1

This is a known issue with Oreo and Xamarin Android on Visual Studio for Windows. It works on Visual Studio for Mac apparently. It will be fixed in an upcoming release. In the mean time there is a work around down near the bottom of the bug link above (comment 20).

Steve Chadbourne
  • 6,873
  • 3
  • 54
  • 82
  • 1
    I dont believe this is Oreo issue. it is not working even using Android 4.0.3 and behavior is exactly how he described. – Emil Dec 21 '17 at 16:48
1
  1. deselecting 'Use Shared Runtime' in Project Properties > Android Options
  2. delete bin & obj files from solution
  3. clean solution
  4. rebuild the solution it works
Wonde_Man
  • 55
  • 6
  • I just uncheck 'Use Shared Runtime' in Project Properties > Android Options; Run (debug) the solution; check 'Use Shared Runtime' in Project Properties > Android Options and run the solution again and it works. – Carlos Busca Dec 11 '19 at 10:03
0

One another reason for that is if you dont enable usb debugging on your device, VS 2017 still recognizes your phone and installs the app on your phone. Just after debugging starts, it will throw this error and not continue debugging. Make sure to enable Developer Mode -> Usb debugging like described here https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/set-up-device-for-development

Emil
  • 6,411
  • 7
  • 62
  • 112