2

I have written an andrioid gradle plugin with IntelliJ.And I used it in an Android application.I would like to debug the plugin.So I tried to create a remote debug in IntelliJ enter image description here

Then do something in Android Studio. Excute
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" and ./gradlew showTips --no-daemon .The result is the IJ debugger can connect to VM,but did not STOP at the breakpoint. My plugin code is this enter image description here

The resule in IJ is this ,and never stop at the breakpoint

Connected to the target VM, address: 'localhost:5005', transport: 'socket'
Disconnected from the target VM, address: 'localhost:5005', transport: 'socket'

What can I do to make the breakpoint to be useful

chefish
  • 397
  • 2
  • 5
  • 19
  • I'm guessing the gradle daemon is complicating things with multiple JVM's. You could [disable the daemon](https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:disabling_the_daemon) by adding `org.gradle.daemon=false` to `gradle.properties` – lance-java Jan 25 '17 at 08:55
  • @LanceJava Thanks, I tried it,but it didnot take effect – chefish Jan 25 '17 at 12:46

1 Answers1

0

I think you also need to set a debug property for gradle. -Dorg.gradle.debug=true

org.gradle.debug
    When set to true, Gradle will run the build with remote debugging enabled,
    listening on port 5005. Note that this is the equivalent of adding
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
    to the JVM command line and will suspend the virtual machine until a
    debugger is attached.

https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

JBirdVegas
  • 9,948
  • 2
  • 41
  • 50
  • I tried to add `-Dorg.gradle.debug=true` in the gradle.properties,but it didnot take effect. Can groovy code be debugged? – chefish Jan 26 '17 at 00:12
  • Can this groovy file remote debug? – chefish Jan 26 '17 at 00:19
  • Groovy code can be debugged but that was from this thread about debugging... https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526/5 – JBirdVegas Jan 26 '17 at 00:26
  • Also you might want to source this question/answer http://stackoverflow.com/a/11129708/873237 – JBirdVegas Jan 26 '17 at 00:27
  • thanks,but it is a bit different.My problem is the debugger can connected but not stop at breakpoint. – chefish Jan 26 '17 at 01:53
  • @chefish Can you answer the question for me Pro https://stackoverflow.com/questions/67042935/how-do-i-place-fragment-arrylist-scrollabletabsactivity – atozcodes Apr 13 '21 at 13:20