Flutter what does --split-debug-info do
--split-debug-info
is about extracting the data needed to produce a humanly readable StackTrace.
When we have a StackTrace, we have both the class/method name and the associated line.Having this information means that the app includes all the information needed to produce such StackTrace – which can weight a lot
--split-debug-info
is about minimizing the names and other similar elements.Then, since it makes the StackTrace unreadable, --split-debug-info
also produce some files that should be preserved, which allows converting a minimized stack trace into something humanly readable.
This unpacking of the StackTrace is done through the flutter symbolize
command – which takes both a minimized stack trace and the outputs of a --split-debug-info
to produce in a normal StackTrace.
The --split-debug-info
flag specifies the directory where Flutter can output debug files.
For example:
flutter build apk --obfuscate --split-debug-info=/<project-name>/<directory>
Here, you can use it to obfuscate your application, build a release versionusing the
--obfuscate
flag, combined with the--split-debug-info
flag.
You need it if you later want to de-obfuscate a stack trace. In fact, once you've obfuscated your binary, this is what manages the backup of the file containing the symbols.
This file will be essential for reading an obscured stack trace or for debugging a stack trace created by your obscured application.
Note that : The --split-debug-info
flag can also be used by itself. In fact, it can dramatically reduce app size.
For more information on app size, see Measuring your app’s size.