Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d966d99

Browse filesBrowse files
authored
fix: add the missing type of debug metadata (#169864)
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Add the missing type of debug metadata Fixes #169252, fixes #169443 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent da95aca commit d966d99
Copy full SHA for d966d99

File tree

Expand file treeCollapse file tree

2 files changed

+79
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+79
-3
lines changed

‎packages/flutter_tools/lib/src/android/gradle.dart

Copy file name to clipboardExpand all lines: packages/flutter_tools/lib/src/android/gradle.dart
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,14 +715,15 @@ class AndroidGradleBuilder implements AndroidBuilder {
715715
return false;
716716
}
717717

718-
// As long as libflutter.so.sym is present for at least one architecture,
718+
// As long as libflutter.so.sym or libflutter.so.dbg is present for at least one architecture,
719719
// assume AGP succeeded in stripping.
720-
if (result.stdout.contains('libflutter.so.sym')) {
720+
if (result.stdout.contains('libflutter.so.sym') ||
721+
result.stdout.contains('libflutter.so.dbg')) {
721722
return true;
722723
}
723724

724725
_logger.printTrace(
725-
'libflutter.so.sym not present when checking final appbundle for debug symbols.',
726+
'libflutter.so.sym or libflutter.so.dbg not present when checking final appbundle for debug symbols.',
726727
);
727728
return false;
728729
}

‎packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart

Copy file name to clipboardExpand all lines: packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
+75Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,16 @@ void main() {
865865
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/
866866
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/arm64-v8a/
867867
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/arm64-v8a/libflutter.so.sym
868+
''';
869+
870+
// Output from `<android_sdk_root>/tools/bin/apkanalyzer files list <aab>`
871+
// on an aab containing the debug info and symbol tables.
872+
const String apkanalyzerOutputWithDebugInfoAndSymFiles =
873+
apkanalyzerOutputWithoutSymFiles +
874+
r'''
875+
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/
876+
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/arm64-v8a/
877+
/BUNDLE-METADATA/com.android.tools.build.debugsymbols/arm64-v8a/libflutter.so.dbg
868878
''';
869879

870880
void createSharedGradleFiles() {
@@ -956,6 +966,71 @@ void main() {
956966
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
957967
);
958968

969+
testUsingContext(
970+
'build succeeds when debug info and symbol tables present for at least one architecture',
971+
() async {
972+
final AndroidGradleBuilder builder = AndroidGradleBuilder(
973+
java: FakeJava(),
974+
logger: logger,
975+
processManager: processManager,
976+
fileSystem: fileSystem,
977+
artifacts: Artifacts.test(),
978+
analytics: fakeAnalytics,
979+
gradleUtils: FakeGradleUtils(),
980+
platform: FakePlatform(environment: <String, String>{'HOME': '/home'}),
981+
androidStudio: FakeAndroidStudio(),
982+
);
983+
processManager.addCommand(
984+
FakeCommand(command: List<String>.of(commonCommandPortion)..add('bundleRelease')),
985+
);
986+
987+
createSharedGradleFiles();
988+
final File aabFile = createAabFile(BuildMode.release);
989+
final AndroidSdk sdk = AndroidSdk.locateAndroidSdk()!;
990+
991+
processManager.addCommand(
992+
FakeCommand(
993+
command: <String>[
994+
sdk.getCmdlineToolsPath(apkAnalyzerBinaryName)!,
995+
'files',
996+
'list',
997+
aabFile.path,
998+
],
999+
stdout: apkanalyzerOutputWithDebugInfoAndSymFiles,
1000+
),
1001+
);
1002+
1003+
final FlutterProject project = FlutterProject.fromDirectoryTest(
1004+
fileSystem.currentDirectory,
1005+
);
1006+
project.android.appManifestFile
1007+
..createSync(recursive: true)
1008+
..writeAsStringSync(minimalV2EmbeddingManifest);
1009+
1010+
await builder.buildGradleApp(
1011+
project: project,
1012+
androidBuildInfo: const AndroidBuildInfo(
1013+
BuildInfo(
1014+
BuildMode.release,
1015+
null,
1016+
treeShakeIcons: false,
1017+
packageConfigPath: '.dart_tool/package_config.json',
1018+
),
1019+
targetArchs: <AndroidArch>[
1020+
AndroidArch.arm64_v8a,
1021+
AndroidArch.armeabi_v7a,
1022+
AndroidArch.x86_64,
1023+
],
1024+
),
1025+
target: 'lib/main.dart',
1026+
isBuildingBundle: true,
1027+
configOnly: false,
1028+
localGradleErrors: <GradleHandledError>[],
1029+
);
1030+
},
1031+
overrides: <Type, Generator>{AndroidStudio: () => FakeAndroidStudio()},
1032+
);
1033+
9591034
testUsingContext(
9601035
'building a debug aab does not invoke apkanalyzer',
9611036
() async {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.