-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Context #60240.
We currently strip debug symbols when building the the AOT snapshot and when building the engine. This means that when Flutter developers build an appbundle (flutter build appbundle) these debug symbols are not available to the Android Gradle plugin (AGP), and therefore they obviously can't be included in the appbundle, which results in the warning in the play store that we see in the linked issue.
Since AGP 4.1, AGP itself can handle both stripping the debug symbols from the native code, and automatically including it in the appbundle in a way that is available to app stores, but does not get delivered to end users* (see https://support.google.com/googleplay/android-developer/answer/9848633#upload_file). So ideally, we could simply stop stripping these files when building for Android, and instead let AGP handle the debug symbols.
HOWEVER - the Flutter Gradle plugin has for some time now vended a recommended version of the NDK (flutter.ndkVersion) that we use to specify the ndkVersion property in apps gradle files, and importantly, if an app specifies an ndk version, and doesn't have that ndk version installed locally, the app will build but silently fail to strip the debug symbols, meaning that they end up in the final app (greatly inflating the app size).
So before we can stop stripping the debug symbols from these files by default, we need to decide on a path that ensures we don't create a foot gun where developers build, unaware that they don't have the ndk version they are specifying installed, and end up with unnecessarily large apps.
In my mind there are two main options, but other suggestions are welcome:
- Get rid of
flutter.ndkVersionentirely via a migrator. If users don't specify an ndk version, apps will instead use the default version provided by AGP. This is option two in this section of the android docs - AGP will download the version by default. There is also a community issue suggesting we do this. - Keep
flutter.ndkVersionaround, and instead modify the flutter tool/flutter doctor to ensure that we check/enforce that users have the version of the ndk that we specify installed.
* More specifically, the symbols get stripped and included in a BUNDLE-METADATA subdirectory of the app bundle format, see this comment for more details.