Skip to content

Commit

Permalink
fix(android): auto-detect old and new way to set applicationId (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Jun 25, 2024
1 parent a873367 commit 016699f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/flutterfire_cli/lib/src/flutter_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ class FlutterApp {
);
if (appGradleFile.existsSync()) {
final fileContents = appGradleFile.readAsStringSync();
// Captures old and new method for setting applicationId in app/build.gradle file:
// https://regex101.com/r/d9i4G6/1
final appIdRegex = RegExp(
r'''applicationId\s['"]{1}(?<applicationId>([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*)['"]{1}''',
r'''applicationId\s*(?:=)?\s*['"](?<applicationId>([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*)['"]''',
);
final match = appIdRegex.firstMatch(fileContents);
if (match != null) {
Expand Down

0 comments on commit 016699f

Please sign in to comment.