Repository navigation
[Reland] Don't strip symbols from libapp.so on android by default - #181275
Conversation
| } | ||
| } | ||
| } | ||
| // Copy the native assets created by build.dart and placed here by flutter assemble. |
There was a problem hiding this comment.
Native assets are now copied by copyJniLibsTask to the jniLibs folder, which is registered as a source set.
There was a problem hiding this comment.
I know it is somewhat orthogonal question, but did we make sure that native assets are also unstripped on Android by default (so that they could also be correctly picked up when publishing)?
cc @dcharkes
There was a problem hiding this comment.
Currently we don't do any stripping for native assets, but maybe we should? I've filed:
|
re requesting your review @mraleph, as you were on the original pr (many months ago) |
There was a problem hiding this comment.
Code Review
This pull request modifies the Android build process to delegate symbol stripping of libapp.so to the Android Gradle Plugin (AGP). This is accomplished by no longer passing the --strip flag to gen_snapshot for Android targets and adjusting the Flutter Gradle Plugin to package .so files directly for AGP to process, rather than within a JAR file. The changes also encompass necessary updates to tests and validation checks to ensure that debug symbols for libapp.so are handled correctly. My review includes suggestions to enhance code style and readability.
| val abi: String? = FlutterPluginConstants.PLATFORM_ARCH_MAP[targetPlatform] | ||
| from("${flutterCompileTask.intermediateDir}/$abi") { | ||
| include("*.so") | ||
| // Move `app.so` to `lib/<abi>/libapp.so` | ||
| rename { filename: String -> "lib/$abi/lib$filename" } | ||
| rename { filename: String -> "lib$filename" } | ||
| into(abi!!) | ||
| } | ||
| // Copy the native assets created by build.dart and placed in build/native_assets by flutter assemble. | ||
| // The `$project.layout.buildDirectory` is '.android/Flutter/build/' instead of 'build/'. | ||
| val buildDir = | ||
| "${FlutterPluginUtils.getFlutterSourceDirectory(project)}/build" | ||
| val nativeAssetsDir = | ||
| "$buildDir/native_assets/android/jniLibs/lib" | ||
| from("$nativeAssetsDir/$abi") { | ||
| include("*.so") | ||
| rename { filename: String -> "lib/$abi/$filename" } | ||
| into(abi!!) | ||
| } |
There was a problem hiding this comment.
To improve null safety and avoid potential runtime exceptions, it's better to explicitly handle the nullable abi variable rather than using the non-null assertion operator (!!). A null check with a warning for unsupported platforms would make the code more robust.
val abi = FlutterPluginConstants.PLATFORM_ARCH_MAP[targetPlatform]
if (abi == null) {
project.logger.warn("Unsupported platform: $targetPlatform. Skipping.")
return@forEach
}
from("${flutterCompileTask.intermediateDir}/$abi") {
include("*.so")
rename { filename: String -> "lib$filename" }
into(abi)
}
// Copy the native assets created by build.dart and placed in build/native_assets by flutter assemble.
val buildDir =
"${FlutterPluginUtils.getFlutterSourceDirectory(project)}/build"
val nativeAssetsDir =
"$buildDir/native_assets/android/jniLibs/lib"
from("$nativeAssetsDir/$abi") {
include("*.so")
into(abi)
}There was a problem hiding this comment.
+1 to !! being risky to use. Are you sure you want to crash here?
There was a problem hiding this comment.
Hmm I had assumed the line that existed before would crash, but string interpolation allows null in kotlin (it just inserts the string "null") so I was wrong about that.
I made both of these cases behave similarly, where we use the string "null" if abi is null (the into() method in the closure doesn't accept a String?)
| if (!(result.stdout.contains('libflutter.so.sym') || | ||
| result.stdout.contains('libflutter.so.dbg'))) { | ||
| _logger.printTrace( | ||
| 'libflutter.so.sym or libflutter.so.dbg not present when checking final appbundle for debug symbols.', | ||
| ); | ||
| return false; | ||
| } | ||
|
|
||
| _logger.printTrace( | ||
| 'libflutter.so.sym or libflutter.so.dbg not present when checking final appbundle for debug symbols.', | ||
| ); | ||
| return false; | ||
| if (!(result.stdout.contains('libapp.so.sym') || result.stdout.contains('libapp.so.dbg'))) { | ||
| _logger.printTrace( | ||
| 'libapp.so.sym or libapp.so.dbg not present when checking final appbundle for debug symbols.', | ||
| ); | ||
| return false; | ||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
The logic for checking debug symbols can be made more readable by extracting the boolean conditions into local variables. This would clarify the intent of each check.
final bool hasFlutterSymbols = result.stdout.contains('libflutter.so.sym') ||
result.stdout.contains('libflutter.so.dbg');
if (!hasFlutterSymbols) {
_logger.printTrace(
'libflutter.so.sym or libflutter.so.dbg not present when checking final appbundle for debug symbols.',
);
return false;
}
final bool hasAppSymbols = result.stdout.contains('libapp.so.sym') || result.stdout.contains('libapp.so.dbg');
if (!hasAppSymbols) {
_logger.printTrace(
'libapp.so.sym or libapp.so.dbg not present when checking final appbundle for debug symbols.',
);
return false;
}
return true;| final bool targetingAndroidPlatform = | ||
| platform == TargetPlatform.android || | ||
| platform == TargetPlatform.android_arm || | ||
| platform == TargetPlatform.android_arm64 || | ||
| platform == TargetPlatform.android_x64; |
There was a problem hiding this comment.
For better readability and maintainability, consider using a Set with the contains method for the targetingAndroidPlatform check, instead of multiple || operators.
| final bool targetingAndroidPlatform = | |
| platform == TargetPlatform.android || | |
| platform == TargetPlatform.android_arm || | |
| platform == TargetPlatform.android_arm64 || | |
| platform == TargetPlatform.android_x64; | |
| final bool targetingAndroidPlatform = const <TargetPlatform>{ | |
| TargetPlatform.android, | |
| TargetPlatform.android_arm, | |
| TargetPlatform.android_arm64, | |
| TargetPlatform.android_x64, | |
| }.contains(platform); |
| packJniLibsTask | ||
| }) | ||
| ) | ||
| val mergeJniLibsTaskName = "merge${FlutterPluginUtils.capitalize(variant.name)}JniLibFolders" |
There was a problem hiding this comment.
Non blocking but this task will need to migrated to the new style with inputs and outputs for agp 9.
| _logger.printTrace('Will strip AOT snapshot manually after build and dSYM generation.'); | ||
| } | ||
| } else if (targetingAndroidPlatform) { | ||
| stripAfterBuild = false; |
There was a problem hiding this comment.
uber nit: comment before setting the variable. (non blocking)
|
autosubmit label was removed for flutter/flutter/181275, because - The status or check suite Windows tool_integration_tests_2_9 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…r#10914) flutter/flutter@7165649...dfd92b7 2026-01-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fixes metal vec3 uniform padding (#181340)" (flutter/flutter#181552) 2026-01-27 [email protected] Change update_engine_version documenation (flutter/flutter#181508) 2026-01-27 [email protected] Roll Packages from e712bfa to e37af11 (7 revisions) (flutter/flutter#181544) 2026-01-27 [email protected] Roll FreeType to 2.14.1 (flutter/flutter#181428) 2026-01-27 [email protected] Roll Skia from 566d202962d3 to c2754838b077 (3 revisions) (flutter/flutter#181536) 2026-01-27 [email protected] [Material] modernize time picker components with Dart 3 switch expressions (flutter/flutter#181356) 2026-01-27 [email protected] Roll Skia from 55a87b50a368 to 566d202962d3 (1 revision) (flutter/flutter#181528) 2026-01-27 [email protected] Roll Dart SDK from f55d4538469a to 4c7cb0a1d07d (2 revisions) (flutter/flutter#181526) 2026-01-27 [email protected] Replace `pub run` mentions with `dart run` (flutter/flutter#181317) 2026-01-27 [email protected] Roll Skia from 1a15ed6b17f2 to 55a87b50a368 (1 revision) (flutter/flutter#181523) 2026-01-27 [email protected] Marks linux_chrome_dev_mode to be unflaky (flutter/flutter#181352) 2026-01-27 [email protected] Roll Skia from f2c1aa140b79 to 1a15ed6b17f2 (2 revisions) (flutter/flutter#181514) 2026-01-27 [email protected] Fix Range Slider issue where indescrete ranges lead to out of range r… (flutter/flutter#181082) 2026-01-26 [email protected] Roll Dart SDK from ba23b5ed0a97 to f55d4538469a (2 revisions) (flutter/flutter#181512) 2026-01-26 [email protected] Add `alignment` to `SizeTransition` (flutter/flutter#177895) 2026-01-26 [email protected] Roll Fuchsia Linux SDK from T4qTEa3T5CCSCIoJY... to akraNGn2lw4T1msgZ... (flutter/flutter#181509) 2026-01-26 [email protected] Roll Skia from be280d242a60 to f2c1aa140b79 (3 revisions) (flutter/flutter#181504) 2026-01-26 [email protected] Fixes metal vec3 uniform padding (flutter/flutter#181340) 2026-01-26 [email protected] Fixes duplicated import in accessibility test library (flutter/flutter#181506) 2026-01-26 [email protected] [Reland] Don't strip symbols from `libapp.so` on android by default (flutter/flutter#181275) 2026-01-26 [email protected] Fix Gradle path in Android Platform Embedder README. (flutter/flutter#181501) 2026-01-26 [email protected] Remove unused `ActivityLifecycleListener` class (flutter/flutter#181406) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…robustness)
libapp.so could be missing from the merged native libraries - causing a
"VM snapshot invalid" crash for APKs, or a "failed to strip debug symbols"
build failure for app bundles - in two scenarios:
* A combined "subprojects { ... evaluationDependsOn(\":app\") }" block in the
root android build.gradle together with a plugin whose Gradle subproject
sorts before ":app". This evaluated ":app" before its build directory was
redirected, so the source-set jniLibs srcDir (resolved eagerly via
.get().asFile) disagreed with the destination copyJniLibs writes to
(resolved lazily), dropping libapp.so.
flutter#186810
* Flavored builds where a prior single-ABI build (e.g. a flutter run on one
device) left the build up to date for only that ABI. copyJniLibs wrote into
a directory nested inside the Flutter task's own output directory, creating
overlapping task outputs that undermined incremental checks.
flutter#187388
Both stem from flutter#181275 moving libapp.so from a jar dependency onto a
source-set jniLibs directory.
Register the source-set srcDir from the lazy provider (not .get().asFile) so
it resolves to the same (possibly redirected) build directory as the copy
destination, and move the staged jniLibs directory to a sibling of the
Flutter task output directory to avoid overlapping outputs. Adds integration
tests covering both scenarios.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
## Summary `libapp.so` could be silently dropped from release APKs and app bundles, surfacing as either: - a runtime crash on launch — `VM snapshot invalid and could not be inferred from settings` — for APKs, or - a `Release app bundle failed to strip debug symbols from native libraries` build failure for app bundles. ## Root cause Regression from flutter#181275, which moved `libapp.so` from a jar dependency onto a Flutter Gradle Plugin source-set `jniLibs` directory. That delivery was fragile in two ways, both of which dropped `libapp.so` from the merged native libraries (while `libflutter.so`/`libdartjni.so`, delivered as AAR dependencies, were unaffected — which is why the failure looked asymmetric): 1. The source-set `jniLibs` `srcDir` was resolved eagerly (`.get().asFile`) at `:app` configuration time, while the copy task wrote lazily. When `:app` was evaluated before its build directory had been redirected — a combined `subprojects { … evaluationDependsOn(":app") }` block (the pre-flutter#91030 template shape) together with a plugin whose Gradle subproject name sorts before `:app` — the two disagreed on the build directory and the staged `libapp.so` was never merged. (flutter#186810) 2. The copy task wrote into a directory nested inside the Flutter task's own output directory, creating overlapping task outputs that undermined Gradle's incremental checks — e.g. a flavored project where a prior single-ABI build (a `flutter run` on one device) left the other ABIs missing `libapp.so`. (flutter#187388) ## Fix Stage `libapp.so` (and any bundled native assets) through a dedicated `CopyFlutterJniLibsTask` whose output is registered on each variant via AGP's variant API: [`variant.sources.jniLibs.addGeneratedSourceDirectory(...)`](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/variant/SourceDirectories#addStaticSourceDirectory(kotlin.String)). AGP then owns the task dependency, resolves the output path lazily (correct regardless of project evaluation order or build-dir redirection), keeps it in its own output directory (no overlapping outputs), and strips/extracts debug symbols from it like any other native library. This restores the robustness of the original jar-based inclusion while keeping `libapp.so` strippable. ## Tests New integration test `gradle_libapp_so_packaging_test.dart` covering both triggers: the combined `subprojects` block + a plugin sorted before `:app`, and a flavored single-ABI build preceding a multi-ABI build. Fixes flutter#186810 Fixes flutter#187388 Fixes flutter#187553
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
## Summary `libapp.so` could be silently dropped from release APKs and app bundles, surfacing as either: - a runtime crash on launch — `VM snapshot invalid and could not be inferred from settings` — for APKs, or - a `Release app bundle failed to strip debug symbols from native libraries` build failure for app bundles. ## Root cause Regression from flutter#181275, which moved `libapp.so` from a jar dependency onto a Flutter Gradle Plugin source-set `jniLibs` directory. That delivery was fragile in two ways, both of which dropped `libapp.so` from the merged native libraries (while `libflutter.so`/`libdartjni.so`, delivered as AAR dependencies, were unaffected — which is why the failure looked asymmetric): 1. The source-set `jniLibs` `srcDir` was resolved eagerly (`.get().asFile`) at `:app` configuration time, while the copy task wrote lazily. When `:app` was evaluated before its build directory had been redirected — a combined `subprojects { … evaluationDependsOn(":app") }` block (the pre-flutter#91030 template shape) together with a plugin whose Gradle subproject name sorts before `:app` — the two disagreed on the build directory and the staged `libapp.so` was never merged. (flutter#186810) 2. The copy task wrote into a directory nested inside the Flutter task's own output directory, creating overlapping task outputs that undermined Gradle's incremental checks — e.g. a flavored project where a prior single-ABI build (a `flutter run` on one device) left the other ABIs missing `libapp.so`. (flutter#187388) ## Fix Stage `libapp.so` (and any bundled native assets) through a dedicated `CopyFlutterJniLibsTask` whose output is registered on each variant via AGP's variant API: [`variant.sources.jniLibs.addGeneratedSourceDirectory(...)`](https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/variant/SourceDirectories#addStaticSourceDirectory(kotlin.String)). AGP then owns the task dependency, resolves the output path lazily (correct regardless of project evaluation order or build-dir redirection), keeps it in its own output directory (no overlapping outputs), and strips/extracts debug symbols from it like any other native library. This restores the robustness of the original jar-based inclusion while keeping `libapp.so` strippable. ## Tests New integration test `gradle_libapp_so_packaging_test.dart` covering both triggers: the combined `subprojects` block + a plugin sorted before `:app`, and a flavored single-ABI build preceding a multi-ABI build. Fixes flutter#186810 Fixes flutter#187388 Fixes flutter#187553
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
…44 fix) Per shorebirdtech/_shorebird#2150 item 1 Part 1: Upstream Flutter PR flutter#181275 (merged 2026-01-26, in 3.44) inverted libapp.so strip responsibility — Flutter stopped stripping it itself, AGP is expected to, and a new post-build check in packages/flutter_tools/lib/src/android/gradle.dart fatal-errors if libapp.so.sym/dbg is absent from the AAB. This breaks two Shorebird flows: 1. Existing apps with the legacy keepDebugSymbols.add("**/libapp.so") line in their build.gradle.kts (AGP skips stripping → no .sym) 2. Obfuscated builds where Shorebird CLI passes --extra-gen-snapshot-options=--strip (gen_snapshot pre-strips → AGP has nothing to strip → no .sym) Both produce valid AABs that run correctly, just without Dart-code crash symbols in Play Console. Demoting the check to a warning lets existing users upgrade to 3.44 without their first build failing, and unblocks the obfuscated CI/release flow. Users get a clear message explaining the trade-off and how to opt into AGP-side stripping.
Relands #162464
Fixes #170664
The only test that failed last time was
Linux_pixel_7pro android_obfuscate_test, and I ran it locally (flutter test test/integration.shard/android_obfuscate_test.dart) to both repro the failure and verify it passes on this branch with the additional changes.Also does some stuff in the FGP:
The reason we failed the tests last time was we were bundling of the libapp.so code into a jar in the aar case, instead of simply including it as its own file in the source sets. I let gemini go on that part, modifying it to no longer pack as a jar, but it looks correct to me. Now that the
libapp.sofile is simply included in this case, AGP is able to strip it (it's not hidden inside a jar).Because this changes the FGP build process for add to app, I manually verified that the add to app flow isn't broken for including a flutter module both as source and as an aar.
Before and after logs from the gradle task output
Before:
After:
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.