Could not connect Jdwp, trying to debug app on emulator

35 views Asked by At

I am using Visual Studio 2022 to create an android app that i am debugging in an emulator. After updating Visual Studio(minor version update 17.9.4) i was unable to debug my application anymore.

The emulator starts fine, but then gives the error: Waiting for debugger Application XXX(xxx) is waiting for the debugger to attach.

In Visual Studio Debug output window it shows the following error:

warning: Could not connect Jdwp. Mono.AndroidTools.AdbException: cannot bind listener: cannot bind to 127.0.0.1:8100: An attempt was made to access a socket in a way forbidden by its access permissions. (10013)
   at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Util\AggregateAsyncResult.cs:line 72
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.Debugging.DebuggingExtensions.<ConnectJdwpAsync>d__7.MoveNext() in D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Debugging\DebuggingExtensions.cs:line 183
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.Debugging.DebuggingExtensions.<StartWithDebuggingAsync>d__1.MoveNext() in D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Debugging\DebuggingExtensions.cs:line 61

I have verified that the port 8100 is already used by the Windows system:

System  4   IPv4 unspecified    8100    TCP Not allowed, not restricted 

My question is, if it is possible to change the port that Jdwp is using or there is another way to get around this problem.

I have of cause looked around and tried a few thing like:

  • Creating new emulators
  • adb root; adb reverse tcp:8080 tcp:8080
  • restarted my machine
  • Reinstalled Androide Emulator Hypervisor Driver and the Android Emulator tools

I have thought about using a real Android to debug my application, but are hoping, i don't have to resort to that. Also think that port 8100, still would be needed in that case.

At the moment i am unable to debug my application, so i am hoping that someone can help me out or point me in the right direction.

0

There are 0 answers