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 8 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