Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

debugging - Android studio 4.1.1 Failed to connect port

I'm using Android studio 4.1.1 on a windows machine with gradle 6.5, NDK version=21.3.6528147 and SDK platform tools 30.0.5

When I try to connect a debugger I get "Failed to connect port" message with exit code 0. (maybe has something to do with lldb, since it's the last thing mentioned before the error message)

If I create a new simple project with empty project the debugger can connect and stop at breakpoints. (My project is a project that I inherited so I don't know all the configurations.)

I tried looking as AndroidManifest.xml but the debugger is enabled. I also updated the NDK version to 30.0.5 (was 29 before) and even tried to update the adb driver just to make sure that it is not the problem. (I also reinstalled the Android sdk and made sure that the project is on debug and not release)

Since the debugger works in a simple app, I guessing it has something to do with the gradle or maybe a configuration that I'm missing.

Any suggestion will be appreciated.

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First of all - you are using a physical device or emulator? Simplest answer is that some other process uses a debugger port. You can enumerate all connections by:

netstat -a -b

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...