diff --git a/packages/flutter_tools/templates/module/android/gradle/build.gradle.tmpl b/packages/flutter_tools/templates/module/android/gradle/build.gradle.tmpl index a0d7f621d6984..f2c623cc887a4 100644 --- a/packages/flutter_tools/templates/module/android/gradle/build.gradle.tmpl +++ b/packages/flutter_tools/templates/module/android/gradle/build.gradle.tmpl @@ -24,11 +24,7 @@ apply plugin: "com.android.library" apply plugin: "kotlin-android" android { - // Conditional for compatibility with AGP <4.2. - if (project.android.hasProperty("namespace")) { - namespace = "{{androidIdentifier}}" - } - + namespace = "{{androidIdentifier}}" compileSdk = {{compileSdkVersion}} defaultConfig { minSdk = {{minSdkVersion}} diff --git a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl index 9219041cd2599..2d9bb8226047c 100644 --- a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl +++ b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl @@ -3,11 +3,7 @@ def flutterPluginVersion = "managed" apply plugin: "com.android.application" android { - // Conditional for compatibility with AGP <4.2. - if (project.android.hasProperty("namespace")) { - namespace = "{{androidIdentifier}}.host" - } - + namespace = "{{androidIdentifier}}.host" compileSdk = {{compileSdkVersion}} compileOptions { diff --git a/packages/flutter_tools/templates/module/android/library_new_embedding/Flutter.tmpl/build.gradle.tmpl b/packages/flutter_tools/templates/module/android/library_new_embedding/Flutter.tmpl/build.gradle.tmpl index c9e3dc7d3e072..5220e77c97c17 100644 --- a/packages/flutter_tools/templates/module/android/library_new_embedding/Flutter.tmpl/build.gradle.tmpl +++ b/packages/flutter_tools/templates/module/android/library_new_embedding/Flutter.tmpl/build.gradle.tmpl @@ -30,11 +30,7 @@ group = "{{androidIdentifier}}" version = "1.0" android { - // Conditional for compatibility with AGP <4.2. - if (project.android.hasProperty("namespace")) { - namespace = "{{androidIdentifier}}" - } - + namespace = "{{androidIdentifier}}" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 2de9662f4a4f5..ae42a58736c20 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -3054,8 +3054,6 @@ void main() { final String buildGradleContent = await buildGradleFile.readAsString(); expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true); - // The namespace should be conditionalized for AGP <4.2. - expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true); }); testUsingContext('Android FFI plugin contains namespace', () async { @@ -3077,8 +3075,6 @@ void main() { final String buildGradleContent = await buildGradleFile.readAsString(); expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true); - // The namespace should be conditionalized for AGP <4.2. - expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true); }); testUsingContext('Android Kotlin plugin contains namespace', () async { @@ -3101,8 +3097,6 @@ void main() { final String buildGradleContent = await buildGradleFile.readAsString(); expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true); - // The namespace should be conditionalized for AGP <4.2. - expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true); }); testUsingContext('Flutter module Android project contains namespace', () async { @@ -3128,13 +3122,6 @@ void main() { expect(moduleFlutterBuildGradleFileContent.contains(expectedNameSpace), true); const String expectedHostNameSpace = 'namespace = "com.bar.foo.flutter_project.host"'; expect(moduleAppBuildGradleFileContent.contains(expectedHostNameSpace), true); - - // The namespaces should be conditionalized for AGP <4.2. - const String expectedConditional = 'if (project.android.hasProperty("namespace")) {'; - expect(moduleBuildGradleFileContent.contains(expectedConditional), true); - expect(moduleAppBuildGradleFileContent.contains(expectedConditional), true); - expect(moduleFlutterBuildGradleFileContent.contains(expectedConditional), true); - }, overrides: { Pub: () => Pub.test( fileSystem: globals.fs,