flutter / flutter/flutter-intellij

can't stop at breakpoint in Android code

Open
#919 4 comments 4 reactions 0 assignees View on GitHub
▣ platform-android
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

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.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.