3

I can't seem to figure out how to make debugging work for a native Android module invoked from a Flutter app via a Platform Channel. I'm using the sample from the Flutter documentation (https://flutter.dev/docs/development/platform-integration/platform-channels). I've tried the following:

  1. Open the Flutter project in IntelliJ
  2. Right click the android folder and select Flutter | Open Android Module in Android Studio
  3. Android Studio opens the native Android code.
  4. Set breakpoints in Android code
  5. Click Debug from Android Studio
  6. Emulator shows "Waiting for Debugger Application is waiting for deubgger to attach" while in Android Studio the debug console shows 'Connected to the target VM, address: 'localhost:8601''
  7. Run Flutter App from IntelliJ (I've also tried Debug from IntelliJ - flutter code will stop on breakpoints)
  8. The breakpoints fro the native Android code never breaks

What am I doing wrong?

Ken
  • 741
  • 2
  • 9
  • 17

2 Answers2

6

I started another project and was able to get it working.

To debug the Flutter code, start the debugger from IntelliJ

To debug the native android code, right click on the android folder and select Flutter | Open Android Module in Android Studio. Start the debugger there. The Flutter app will open in the emulator and you can set/hit breakpoints in the native code

Ken
  • 741
  • 2
  • 9
  • 17
1

What worked for me was running the app in debug mode in Android Studio and then pressing the "Attach Debugger to Android Process" button.

molundb
  • 484
  • 1
  • 4
  • 18