Forum Xamarin.Android

Debugger error

WilfordMorrisonWilfordMorrison JMUniversity ✭✭
edited September 2016 in Xamarin.Android

Hello,
Just updated to the latest version of Xamarin 3 days ago and all hell broke loose. My app was working fine using the genymotion emulator on api 21. I was using ndk r10e and Java sdk 1.8.0_65. The first thing I notice was that My app could not see the genymotion emulator anymore for deployment. I was getting this error (visual studio 2015 diagnostics): Only the last part shown below

**1> External: False
1> ManifestTemplate: obj\Debug\android\AndroidManifest.xml
1> EnableInstantRun: False
1> InstantRunForceUploadApk: False
1> AndroidSdkPath: C:\Program Files (x86)\Android\android-sdk
1> AndroidNdkPath: C:\Program Files (x86)\Android
1>dk\android-ndk-r10e
1> JavaSdkPath: C:\Program Files (x86)\Java\jdk1.8.0_65
1> Found AndroidSdk at C:\Program Files (x86)\Android\android-sdk
1> Found AndroidNdk at C:\Program Files (x86)\Android
1>dk\android-ndk-r10e
1> Found AndroidTools at C:\Program Files (x86)\Android\android-sdk\tools
1>Selected device is not running.
1>Done executing task "InstallPackageAssemblies" -- FAILED.
1>Done building target "_Upload" in project "Prototype.Droid.csproj" -- FAILED.
1>Done building project "Prototype.Droid.csproj" -- FAILED.
1>Build FAILED.
**
After 2 days investigating I found out that the updated android sdk uses ADB version 1.0.36 while genymotion 2.7.2 uses 1.0.32. Great to know, so I point my genymotion to use the same ADB as visual studio. The deployment error went away and the app now runs. However, I am not able to debug. If I try it crashes. I am getting this list of error from Xamarim Diagnostics:

**Android application is debugging.
=thread-group-added,id="i1"
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32msvc".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=tsv-created,name="trace_timestamp",initial="0"\n
0xf76b2d82 in syscall () from libc.so
Loaded 'C:\C# Projects\Apps Dev\Your Messengar App\ServerApps\Prototype\MessagePrototype\Prototype.Droid\bin\Debug\linker'
Loaded 'libc.so'
Loaded 'libm.so'
Loaded 'libstdc++.so'
Loaded 'liblog.so'
Loaded 'libsigchain.so'
Loaded 'libcutils.so'
Loaded 'libstlport.so'
Loaded 'libgccdemangle.so'
Loaded 'libunwind.so'
Loaded 'libunwind-ptrace.so'
Loaded 'libbacktrace.so'
Loaded 'libutils.so'
Loaded 'libGLES_trace.so'
Loaded 'libEGL.so'
Loaded 'libETC1.so'
Loaded 'libGLESv1_CM.so'
Loaded 'libGLESv2.so'
Loaded 'libbinder.so'
Loaded 'libz.so'
Loaded 'libandroidfw.so'
Loaded 'libspeexresampler.so'
Loaded 'libaudioutils.so'
Loaded 'libcamera_metadata.so'
Loaded 'libsync.so'
Loaded 'libhardware.so'
Loaded 'libui.so'
Loaded 'libgui.so'
Loaded 'libcamera_client.so'
Loaded 'libcrypto.so'
Loaded 'libexpat.so'
Loaded 'libnetutils.so'
Loaded 'libwpa_client.so'
Loaded 'libhardware_legacy.so'
Loaded 'libgabi++.so'
Loaded 'libicuuc.so'
Loaded 'libicui18n.so'
Loaded 'libharfbuzz_ng.so'
Loaded 'libc++.so'
Loaded 'libLLVM.so'
Loaded 'libbcinfo.so'
Loaded 'libbcc.so'
Loaded 'libpng.so'
Loaded 'libft2.so'
Loaded 'libRS.so'
Loaded 'libRScpp.so'
Loaded 'libjpeg.so'
Loaded 'libskia.so'
Loaded 'libhwui.so'
Loaded 'libimg_utils.so'
Loaded 'libinput.so'
Loaded 'libinputflinger.so'
Loaded 'libcommon_time_client.so'
Loaded 'libnbaio.so'
Loaded 'libsonivox.so'
Loaded 'libstagefright_foundation.so'
Loaded 'libmedia.so'
Loaded 'libmemtrack.so'
Loaded 'libminikin.so'
Loaded 'libnativebridge.so'
Loaded 'libnativehelper.so'
Loaded 'libnetd_client.so'
Loaded 'libpdfium.so'
Loaded 'libprocessgroup.so'
Loaded 'libselinux.so'
Loaded 'libsoundtrigger.so'
Loaded 'libsqlite.so'
Loaded 'libssl.so'
Loaded 'libusbhost.so'
Loaded 'libandroid_runtime.so'
Loaded 'libbacktrace_libc++.so'
Loaded 'libart.so'
Loaded 'libjavacore.so'
Loaded 'libexif.so'
Loaded 'libjhead.so'
Loaded 'libmtp.so'
Loaded 'libdrmframework.so'
Loaded 'libopus.so'
Loaded 'libpowermanager.so'
Loaded 'libstagefright_avc_common.so'
Loaded 'libstagefright_enc_common.so'
Loaded 'libstagefright_omx.so'
Loaded 'libstagefright_yuv.so'
Loaded 'libvorbisidec.so'
Loaded 'libstagefright.so'
Loaded 'libstagefright_amrnb_common.so'
Loaded 'libmedia_jni.so'
Loaded 'libavutil.so'
Loaded 'libswresample.so'
Loaded 'libavcodec.so'
Loaded 'libavformat.so'
Loaded 'libffmpeg_utils.so'
Loaded 'libFFmpegExtractor.so'
Loaded 'libsoundpool.so'
Loaded 'libaudioeffect_jni.so'
Loaded 'librs_jni.so'
Loaded 'libjavacrypto.so'
Loaded 'libandroid.so'
Loaded 'libcompiler_rt.so'
Loaded 'libjnigraphics.so'
Loaded 'libwebviewchromium_loader.so'
[New Thread 5987.6033]
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libmonodroid.so
Loaded 'libmonodroid.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libmonosgen-2.0.so
Loaded 'libmonosgen-2.0.so'
[New Thread 5987.6054]
[New Thread 5987.6055]
[New Thread 5987.6056]
[New Thread 5987.6057]
[New Thread 5987.6058]
[New Thread 5987.6059]
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libGLESv1_enc.so
Loaded 'libGLESv1_enc.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libGLESv2_enc.so
Loaded 'libGLESv2_enc.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded lib_renderControl_enc.so
Loaded 'lib_renderControl_enc.so'
[New Thread 5987.6062]
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libOpenglSystemCommon.so
Loaded 'libOpenglSystemCommon.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded gralloc.vbox86.so
Loaded 'gralloc.vbox86.so'
[New Thread 5987.6064]
[Switching to Thread 5987.6059]
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libEGL_emulation.so
Loaded 'libEGL_emulation.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libGLESv1_CM_emulation.so
Loaded 'libGLESv1_CM_emulation.so'
Stopped due to shared library event (no libraries added or removed)
Stopped due to shared library event:
Inferior loaded libGLESv2_emulation.so
Loaded 'libGLESv2_emulation.so'
[New Thread 5987.6066]
[New Thread 5987.6067]
[New Thread 5987.6070]

Thread 19 "Timer-Scheduler" received signal SIGPWR, Power fail/restart.
[Switching to Thread 5987.6064]
0xf76b2d82 in syscall () from libc.so
Power fail/restart
**

IF I CONTINUE INSTEAD OF BREAK ON THE EXCEPTION WINDOW IT SHOWS THIS:
**[New Thread 6361.6454]

Thread 1 "Prototype.Droid" received signal SIGPWR, Power fail/restart.
[Switching to Thread 6361.6361]
0xf7713915 in __epoll_pwait () from libc.so
Power fail/restart

Thread 19 "Timer-Scheduler" received signal SIGXCPU, CPU time limit exceeded.
[Switching to Thread 6361.6446]
0xf77145c1 in __rt_sigsuspend () from libc.so
CPU time limit exceeded

Thread 1 "Prototype.Droid" received signal SIGXCPU, CPU time limit exceeded.
[Switching to Thread 6361.6361]
0xf77145c1 in __rt_sigsuspend () from libc.so
CPU time limit exceeded**

The app works fine in the emulator but of course I am not able to debug.

I have tried various changes to fix this issue:
1. Updated the java sdk to 1.8.0_101
2. Updated android ndk to r12b
3. Updated genymotion to 2.8.0 (latest version)
4. Update visual studio 2015 with the latest patch
5. Tried another emulator from Android but I am getting an ADB error asking me to reset or restart the emulator.....

I am posting here before it still not working. Any assistance would be greatly appreciated....

Regards,
Will

Answers

  • WilfordMorrisonWilfordMorrison JMUniversity ✭✭

    Hello Again,
    After further checks I realised that I had a messed up android SDK on my computer. Had more that one version on my computer, so I removed all of them. I then installed android studio (2.2.0.12) with the latest SDK. I also install the latest version of Xamarin 4.20.680 with Xamarin.Android (7.0.0.18) and Xamarin.iOS (10.0.0.6). I then build the app again which produce no errors. However deploying to a number of emulators was a different story. This is the output I am getting with all the following emulators:

    1. Genymotion (2.8.0).
      The deployment fail with the follow error

      1>C:\Users\admin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 192.168.243.101:5555 devices
      1>error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
      1>could not read ok from ADB Server
      1>* failed to start daemon *
      1>error: cannot connect to daemon
      1>List of devices attached
      1>adb server version (32) doesn't match this client (36); killing...
      1>
      1>Selected device is not running.
      1>Build FAILED.


      This was explained in my previous post regarding the version of adb being used by android as against genymotion

    2. Android emulator (from AVD):
      The app deploys but I got this error
      "Unable to start debugging. Unable to connect to the Android Debug Bridge (adb). If the problem continues, try restarting the device/emulator or resetting adb"
      Of course I did what was suggested but nothing changed.

    3. Xamarin Android Player (0.6.5):
      The app deploys but while executing (debug) the following error occur
      [New Thread 1768]
      [Switching to Thread 1768]
      Loaded 'libEGL_xap.so'
      Loaded 'libGLESv1_CM_xap.so'
      Loaded 'libGLESv2_xap.so'
      [New Thread 1769]
      [Switching to Thread 1769]
      [New Thread 1761]
      [New Thread 1762]
      [New Thread 1763]
      [New Thread 1764]
      [New Thread 1765]
      [New Thread 1766]
      [New Thread 1767]
      [New Thread 1770]
      [New Thread 1771]
      Power fail/restart

    So I am back at square one. With what I have read, I am thinking something is not right with adb. Anyone having problems using the latest android sdk in particular adb?

    Regards,
    Will

  • PubuduGayanPubuduGayan NZMember ✭✭✭

    @WilfordMorrison check your hyper v , and check process compatibility is ticked in your simulator.

  • WilfordMorrisonWilfordMorrison JMUniversity ✭✭

    @PubuduGayan, I am not using Hyper V. It slows down genymotion as I have to turn off the accelerations in Oracle VB. I have never used Hyper V.

  • PubuduGayanPubuduGayan NZMember ✭✭✭

    @WilfordMorrison can you tell me whats your development env?

  • WilfordMorrisonWilfordMorrison JMUniversity ✭✭
    edited September 2016

    -Window 10 Pro
    -Microsoft Visual Studio Enterprise 2015
    Version 14.0.25431.01 Update 3
    Microsoft .NET Framework
    Version 4.6.01586

    -Xamarin 4.2.0.695 (7603786)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin.Android 7.0.1.2 (c1d1c79)
    Visual Studio extension to enable development for Xamarin.Android.

    Xamarin.iOS 10.0.0.1 (29910bb)
    Visual Studio extension to enable development for Xamarin.iOS.

    -Java sdk 1.8.0_101

    -Java ndk r10e

    -genymotion 2.8.0

    -VirtualBox Graphical User Interface
    Version 5.0.24 r108355

    -Matrix (AG-Software) 2.0.0.20

    -Other development tools

    By the way I just updated to the latest version of Xamarin (release today) but the problems persist.

    Regards,
    Will

  • WilfordMorrisonWilfordMorrison JMUniversity ✭✭
    edited September 2016

    Tried something else today. Testing a direction suggested by @PubuduGayan. I enabled Hyper V and stopped using the genymotion (and Oracle Virtual Box) for the time being. Instead ran the app in the VS Emulator for Android. The app ran but would not hit any breakpoint in VS. Moving the mouse over the breakpoint display the following popup message

    **"The break point will not current be hit. Module containing this break point has not yet been loaded or the breakpoint address could not be obtained". **

    This not true since the activity in questions where the break point is active is on the emulator awaiting user input. This is the first time I am seeing this message is VS.

    The attach file represents a message in the emulator at the start of the app. I have been getting this message since this issue started 6 days ago.

    My observation is that there is an issue with the adb in Android and Xamarin is having issues handling it in VS.

    Regards,
    Will

  • PubuduGayanPubuduGayan NZMember ✭✭✭

    @WilfordMorrison try to install adroid for visual studio simulator. probably you already did this have you install development options to the simulator. ?

  • WilfordMorrisonWilfordMorrison JMUniversity ✭✭
    edited September 2016

    Hello,
    I found the issue with the debugger. In the android project properties, the option for debugger was set to Microsoft not Xamarin. Not sure how this got changed in the first place, but putting it to Xamarin fixed all the issues. I am now able to debug normally. Thanks for the help @PubuduGayan, your research direction open my eyes to Hyper V. I was never a fan, but not anymore.....

    Regards,
    Will

Sign In or Register to comment.