Reputation: 1719
Using Android Studio 3.1.3
gradle 3.1.2
Runnung Remote build with default config with 5005 port
and
in gradle.properties file
org.gradle.daemon=false org.gradle.jvmargs= -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
always getting error:
Error running 'APT': Unable to open debugger port (127.0.0.0:5005): java.net.ConnectException "Operation timed out (Connection timed out)"
Upvotes: 3
Views: 1668
Reputation: 168
There is an OOB way to debug gradle tasks in Android Studio: open terminal and in you project root type
./gradlew :app:clean :app:compileDebugJavaWithJavac
Instead of starting it right away just press Ctrl+Shift+Enter (Execute built-in alternative in debug mode)
Android Studio will then create a new configuration and immediately start it in debug mode. Any breakpoints in your Annotation Processor will be hit as during usual debug session.
Next time you'll ever need to start debugging just select this new configuration and press Debug button next to it.
Upvotes: 0
Reputation: 5385
How I made it work -
Step 1 Run the below command in the terminal
./gradlew --no-daemon -Dorg.gradle.debug=true :app:clean :app:compileDebugJavaWithJavac
Step 2 Go to run
-> Edit Configurations
-> '+'
in the top left corner -> Remote
-> Give a name to this configuration, and ensure that the port number is 5005 -> OK
.
Step 3 Select your configuration from the drop-down & debug.
Upvotes: 4