6

From the docs:

When building a release version of your app, consider using the --split-debug-info tag. This flag can dramatically reduce code size. For an example of using this flag

I also checked Obfuscating Dart code:

To obfuscate your app, build a release version using the --obfuscate flag, combined with the --split-debug-info flag. The --split-debug-info flag specifies the directory where Flutter can output debug files. This command generates a symbol map. The apk, appbundle, ios, and ios-framework targets are currently supported (macos and aar are supported on the master and dev channels).

I do understand what obfuscating dart code means, but I can't find what --split-debug-info does on its own. I read it splits debug info. What info are we talking about, are there any disadvantages and how is it different from obfuscating?

2 Answers 2

8

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

2

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 version using 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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.