Skip to content

Commit a86beaf

Browse files
[various] Conditionalize the namespace in all Android plugins (#3836)
The recent change to add `namespace` to all plugins broke builds for apps using AGP 4.1 or earlier. This conditionalizes setting the namespace based on whether the property exists at all, making it compatible with both AGP 8.0 and AGP <4.2. Updates tooling to enforce this for plugin (but not example app) build.gradle files. Fixes flutter/flutter#125621
1 parent 2047645 commit a86beaf

File tree

47 files changed

+206
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+206
-38
lines changed

packages/camera/camera_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.6+2
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 0.10.6+1
26

37
* Adds a namespace for compatibility with AGP 8.0.

packages/camera/camera_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ project.getTasks().withType(JavaCompile){
2727
apply plugin: 'com.android.library'
2828

2929
android {
30-
namespace 'io.flutter.plugins.camera'
30+
// Conditional for compatibility with AGP <4.2.
31+
if (project.android.hasProperty("namespace")) {
32+
namespace 'io.flutter.plugins.camera'
33+
}
3134
compileSdkVersion 33
3235

3336
defaultConfig {

packages/camera/camera_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_android
22
description: Android implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.10.6+1
5+
version: 0.10.6+2
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/camera/camera_android_camerax/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.camerax'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.camerax'
28+
}
2629
// CameraX dependencies require compilation against version 33 or later.
2730
compileSdkVersion 33
2831

packages/espresso/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.0+4
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 0.3.0+3
26

37
* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

packages/espresso/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'com.example.espresso'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'com.example.espresso'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/espresso/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Java classes for testing Flutter apps using Espresso.
33
Allows driving Flutter widgets from a native Espresso test.
44
repository: https://github.com/flutter/packages/tree/main/packages/espresso
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+espresso%22
6-
version: 0.3.0+3
6+
version: 0.3.0+4
77

88
environment:
99
sdk: ">=2.17.0 <4.0.0"

packages/flutter_plugin_android_lifecycle/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.13
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 2.0.12
26

37
* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

packages/flutter_plugin_android_lifecycle/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.flutter_plugin_android_lifecycle'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.flutter_plugin_android_lifecycle'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/flutter_plugin_android_lifecycle/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: flutter_plugin_android_lifecycle
22
description: Flutter plugin for accessing an Android Lifecycle within other plugins.
33
repository: https://github.com/flutter/packages/tree/main/packages/flutter_plugin_android_lifecycle
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_plugin_android_lifecycle%22
5-
version: 2.0.12
5+
version: 2.0.13
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.4.13
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 2.4.12
26

37
* Fixes Java warnings.

packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.googlemaps'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.googlemaps'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_maps_flutter_android
22
description: Android implementation of the google_maps_flutter plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
5-
version: 2.4.12
5+
version: 2.4.13
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/google_sign_in/google_sign_in_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.1.14
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 6.1.13
26

37
* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

packages/google_sign_in/google_sign_in_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.googlesignin'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.googlesignin'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/google_sign_in/google_sign_in_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_sign_in_android
22
description: Android implementation of the google_sign_in plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
5-
version: 6.1.13
5+
version: 6.1.14
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/image_picker/image_picker_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.6+9
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 0.8.6+8
26

37
* Adds a namespace for compatibility with AGP 8.0.

packages/image_picker/image_picker_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.imagepicker'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.imagepicker'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/image_picker/image_picker_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Android implementation of the image_picker plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
55

6-
version: 0.8.6+8
6+
version: 0.8.6+9
77

88
environment:
99
sdk: ">=2.18.0 <4.0.0"

packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.5+4
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 0.2.5+3
26

37
* Updates com.android.billingclient:billing from 5.1.0 to 5.2.0.

packages/in_app_purchase/in_app_purchase_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.inapppurchase'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.inapppurchase'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/in_app_purchase/in_app_purchase_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase_android
22
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
33
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 0.2.5+3
5+
version: 0.2.5+4
66

77
environment:
88
sdk: ">=2.18.0 <4.0.0"

packages/local_auth/local_auth_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.27
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 1.0.26
26

37
* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

packages/local_auth/local_auth_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.localauth'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.localauth'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/local_auth/local_auth_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: local_auth_android
22
description: Android implementation of the local_auth plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/local_auth/local_auth_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
5-
version: 1.0.26
5+
version: 1.0.27
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/path_provider/path_provider_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.27
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 2.0.26
26

37
* Adds a namespace for compatibility with AGP 8.0.

packages/path_provider/path_provider_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.pathprovider'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.pathprovider'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/path_provider/path_provider_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: path_provider_android
22
description: Android implementation of the path_provider plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
5-
version: 2.0.26
5+
version: 2.0.27
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'com.example.alternate_language_test_plugin'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'com.example.alternate_language_test_plugin'
28+
}
2629
compileSdkVersion 33
2730

2831
compileOptions {

packages/pigeon/platform_tests/test_plugin/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
namespace 'com.example.test_plugin'
28+
// Conditional for compatibility with AGP <4.2.
29+
if (project.android.hasProperty("namespace")) {
30+
namespace 'com.example.test_plugin'
31+
}
2932
compileSdkVersion 33
3033

3134
compileOptions {

packages/quick_actions/quick_actions_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.4
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 1.0.3
26

37
* Adds a namespace for compatibility with AGP 8.0.

packages/quick_actions/quick_actions_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.quickactions'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.quickactions'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/quick_actions/quick_actions_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: quick_actions_android
22
description: An implementation for the Android platform of the Flutter `quick_actions` plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 1.0.3
5+
version: 1.0.4
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/shared_preferences/shared_preferences_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.4
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 2.1.3
26

37
* Adds a namespace for compatibility with AGP 8.0.

packages/shared_preferences/shared_preferences_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ allprojects {
3030
apply plugin: 'com.android.library'
3131

3232
android {
33-
namespace 'io.flutter.plugins.sharedpreferences'
33+
// Conditional for compatibility with AGP <4.2.
34+
if (project.android.hasProperty("namespace")) {
35+
namespace 'io.flutter.plugins.sharedpreferences'
36+
}
3437
compileSdkVersion 33
3538

3639
compileOptions {

packages/shared_preferences/shared_preferences_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: shared_preferences_android
22
description: Android implementation of the shared_preferences plugin
33
repository: https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22
5-
version: 2.1.3
5+
version: 2.1.4
66

77
environment:
88
sdk: ">=2.17.0 <4.0.0"

packages/url_launcher/url_launcher_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.0.31
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 6.0.30
26

37
* Adds `targetCompatibilty` matching `sourceCompatibility` for older toolchains.

packages/url_launcher/url_launcher_android/android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ rootProject.allprojects {
2222
apply plugin: 'com.android.library'
2323

2424
android {
25-
namespace 'io.flutter.plugins.urllauncher'
25+
// Conditional for compatibility with AGP <4.2.
26+
if (project.android.hasProperty("namespace")) {
27+
namespace 'io.flutter.plugins.urllauncher'
28+
}
2629
compileSdkVersion 33
2730

2831
defaultConfig {

packages/url_launcher/url_launcher_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: url_launcher_android
22
description: Android implementation of the url_launcher plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
5-
version: 6.0.30
5+
version: 6.0.31
66

77
environment:
88
sdk: ">=2.18.0 <4.0.0"

packages/video_player/video_player_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.4.6
2+
3+
* Fixes compatibility with AGP versions older than 4.2.
4+
15
## 2.4.5
26

37
* Adds a namespace for compatibility with AGP 8.0.

0 commit comments

Comments
 (0)