Skip to content

Commit de1c0f0

Browse files
gmackallTytaniumDev
authored andcommitted
Remove conditionality in templates that was for AGP <= 4.2 support (flutter#151845)
Not needed after flutter#149204 (as long as nothing has changed since the comment was made �). Fixes flutter#145105.
1 parent 7a9f0c1 commit de1c0f0

File tree

4 files changed

+3
-28
lines changed

4 files changed

+3
-28
lines changed

packages/flutter_tools/templates/module/android/gradle/build.gradle.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ apply plugin: "com.android.library"
2424
apply plugin: "kotlin-android"
2525

2626
android {
27-
// Conditional for compatibility with AGP <4.2.
28-
if (project.android.hasProperty("namespace")) {
29-
namespace = "{{androidIdentifier}}"
30-
}
31-
27+
namespace = "{{androidIdentifier}}"
3228
compileSdk = {{compileSdkVersion}}
3329
defaultConfig {
3430
minSdk = {{minSdkVersion}}

packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ def flutterPluginVersion = "managed"
33
apply plugin: "com.android.application"
44

55
android {
6-
// Conditional for compatibility with AGP <4.2.
7-
if (project.android.hasProperty("namespace")) {
8-
namespace = "{{androidIdentifier}}.host"
9-
}
10-
6+
namespace = "{{androidIdentifier}}.host"
117
compileSdk = {{compileSdkVersion}}
128

139
compileOptions {

packages/flutter_tools/templates/module/android/library_new_embedding/Flutter.tmpl/build.gradle.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ group = "{{androidIdentifier}}"
3030
version = "1.0"
3131

3232
android {
33-
// Conditional for compatibility with AGP <4.2.
34-
if (project.android.hasProperty("namespace")) {
35-
namespace = "{{androidIdentifier}}"
36-
}
37-
33+
namespace = "{{androidIdentifier}}"
3834
compileSdk = flutter.compileSdkVersion
3935
ndkVersion = flutter.ndkVersion
4036

packages/flutter_tools/test/commands.shard/permeable/create_test.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,8 +3054,6 @@ void main() {
30543054
final String buildGradleContent = await buildGradleFile.readAsString();
30553055

30563056
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
3057-
// The namespace should be conditionalized for AGP <4.2.
3058-
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
30593057
});
30603058

30613059
testUsingContext('Android FFI plugin contains namespace', () async {
@@ -3077,8 +3075,6 @@ void main() {
30773075
final String buildGradleContent = await buildGradleFile.readAsString();
30783076

30793077
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
3080-
// The namespace should be conditionalized for AGP <4.2.
3081-
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
30823078
});
30833079

30843080
testUsingContext('Android Kotlin plugin contains namespace', () async {
@@ -3101,8 +3097,6 @@ void main() {
31013097
final String buildGradleContent = await buildGradleFile.readAsString();
31023098

31033099
expect(buildGradleContent.contains('namespace = "com.bar.foo.flutter_project"'), true);
3104-
// The namespace should be conditionalized for AGP <4.2.
3105-
expect(buildGradleContent.contains('if (project.android.hasProperty("namespace")) {'), true);
31063100
});
31073101

31083102
testUsingContext('Flutter module Android project contains namespace', () async {
@@ -3128,13 +3122,6 @@ void main() {
31283122
expect(moduleFlutterBuildGradleFileContent.contains(expectedNameSpace), true);
31293123
const String expectedHostNameSpace = 'namespace = "com.bar.foo.flutter_project.host"';
31303124
expect(moduleAppBuildGradleFileContent.contains(expectedHostNameSpace), true);
3131-
3132-
// The namespaces should be conditionalized for AGP <4.2.
3133-
const String expectedConditional = 'if (project.android.hasProperty("namespace")) {';
3134-
expect(moduleBuildGradleFileContent.contains(expectedConditional), true);
3135-
expect(moduleAppBuildGradleFileContent.contains(expectedConditional), true);
3136-
expect(moduleFlutterBuildGradleFileContent.contains(expectedConditional), true);
3137-
31383125
}, overrides: <Type, Generator>{
31393126
Pub: () => Pub.test(
31403127
fileSystem: globals.fs,

0 commit comments

Comments
 (0)