text
stringlengths
1
372
in update test flutter app.
info note
if you want to use the GNU project debugger to debug the
flutter engine running within an android app process,
check out flutter_gdb.
<topic_end>
<topic_start>
build the android version of the flutter app in the terminal
to generate the needed android platform dependencies,
run the flutter build command.
<topic_end>
<topic_start>
start debugging with VS code first
if you use VS code to debug most of your code, start with this section.
to open the flutter app directory, go to
file >
open folder… and choose the my_app directory.
open the lib/main.dart file.
if you can build an app for more than one device,
you must select the device first.
go to
view >
command palette…
you can also press ctrl / cmd +
shift + p.
type flutter select.
click the flutter: select device command.
choose your target device.
click the debug icon
().
this opens the debug pane and launches the app.
wait for the app to launch on the device and for the debug pane to
indicate connected.
the debugger takes longer to launch the first time.
subsequent launches start faster.
this flutter app contains two buttons:
<topic_end>
<topic_start>
attach to the flutter process in android studio
click the attach debugger to android process button.
()
lightbulb tip
if this button doesn’t appear in the projects menu bar, verify that
you opened flutter application project but not a flutter plugin.
the process dialog displays one entry for each connected device.
select show all processes to display available processes for each
device.
choose the process to which you want to attach.
for this guide, select the com.example.my_app process
using the emulator Pixel_5_API_33.
locate the tab for android debugger in the debug pane.
in the project pane, expand
my_app_android >
android >
app >
src >
main >
java >
io.flutter plugins.
double click GeneratedProjectRegistrant to open the
java code in the edit pane.
at the end of this procedure, both the dart and android debuggers interact
with the same process.
use either, or both, to set breakpoints, examine stack, resume execution
and the like. in other words, debug!
<topic_end>
<topic_start>
start debugging with android studio first
if you use android studio to debug most of your code, start with this section.
to open the flutter app directory, go to
file >
open… and choose the my_app directory.
open the lib/main.dart file.
choose a virtual android device.
go to the toolbar, open the leftmost dropdown menu, and click on
open android emulator: <device>.
you can choose any installed emulator that’s doesn’t include arm64.
from that same menu, select the virtual android device.
from the toolbar, click run ‘main.dart’.
you can also press ctrl + shift + r.
after the app displays in the emulator, continue to the next step.
click the attach debugger to android process button.
()
lightbulb tip
if this button doesn’t appear in the projects menu bar, verify that
you opened flutter application project but not a flutter plugin.
the process dialog displays one entry for each connected device.
select show all processes to display available processes for each
device.
choose the process to which you want to attach.
for this guide, select the com.example.my_app process
using the emulator Pixel_5_API_33.
locate the tab for android debugger in the debug pane.
in the project pane, expand
my_app_android >
android >
app >
src >
main >
java >