flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

can't stop at breakpoint in Android code

Open skybrian opened this issue 9 years ago • 4 comments

Setting a breakpoint in Java code and running the Flutter app in debug mode will not stop at the breakpoint.

To reproduce:

  • create a new Flutter app

  • Add code to _MyHomePageState in main.dart to call a platform method when you click:

  static const platform = const PlatformMethodChannel('click/hello');
      _counter++;
      platform.invokeMethod("hello");
  • Add code to Java that logs the method:

In MainActivity:

    private static final String CHANNEL = "click2/hello";

At the end of onCreate:

        new FlutterMethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(
                new FlutterMethodChannel.MethodCallHandler() {
                    @Override
                    public void onMethodCall(MethodCall call, FlutterMethodChannel.Response response) {
                        Log.i("click", "method called: " + call.method);
                    }
                });

Start the app in the debugger. You can set a breakpoint in Dart code but not in Java code. (But, if you log a message, it does show up in the console.)

skybrian avatar Apr 18 '17 00:04 skybrian

I'm not sure how we'd implement this, since it's not an Observatory thing. But it seems like users will want it.

skybrian avatar Apr 18 '17 00:04 skybrian

Is this still a thing? Not being able to break in the native code makes life pretty tough.

cal-pratt avatar Jul 10 '18 03:07 cal-pratt

@stevemessick I think you may have fixed this case.

jacob314 avatar Mar 08 '19 01:03 jacob314

I haven't been able to put a breakpoint in native code when running flutter on the desktop, so I don't think this is fixed.

agentsim avatar Oct 11 '22 21:10 agentsim