[flutter_tools] Add namespace getter in Android project; use namespace as fallback (#121416)

[flutter_tools] Add namespace getter in Android project; use namespace as fallback
This commit is contained in:
Navaron Bracke
2023-03-09 23:19:04 +01:00
committed by GitHub
parent 06206c2f3a
commit 57171a3fef
3 changed files with 90 additions and 4 deletions

View File

@@ -171,7 +171,10 @@ class AndroidApk extends ApplicationPackage implements PrebuiltApplicationPackag
logger.printError('Please check ${manifest.path} for errors.');
return null;
}
final String? packageId = manifests.first.getAttribute('package');
// Starting from AGP version 7.3, the `package` attribute in Manifest.xml
// can be replaced with the `namespace` attribute under the `android` section in `android/app/build.gradle`.
final String? packageId = manifests.first.getAttribute('package') ?? androidProject.namespace;
String? launchActivity;
for (final XmlElement activity in document.findAllElements('activity')) {