[url_launcher_android] Set buildFeatures.buildConfig to true for compatibility with AGP 8.0+ (#4535)

This flag controls the generation of the BuildConfig class, which is [used to guard a log line](05fdd1337f/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncher.java (L66)).

In AGP 7.x this flag [defaulted to true](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/BuildFeatures#buildConfig:kotlin.Boolean). AGP 8.x [changed it to default to false](https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/BuildFeatures#buildConfig()). This PR sets it explicitly to true, so we don't rely on defaults, and fixes an error for people using AGP 8.0+. I also upgraded an old AGP version while I was at it.

Fixes https://github.com/flutter/flutter/issues/128204.
This commit is contained in:
gmackall
2023-07-20 16:11:47 -07:00
committed by GitHub
parent a9731f23d3
commit 896131fa03
3 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
## 6.0.37
* Sets android.defaults.buildfeatures.buildconfig to true for compatibility with AGP 8.0+.
## 6.0.36 ## 6.0.36
* Bumps androidx.annotation:annotation from 1.2.0 to 1.6.0. * Bumps androidx.annotation:annotation from 1.2.0 to 1.6.0.

View File

@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.0' classpath 'com.android.tools.build:gradle:7.3.0'
} }
} }
@ -22,6 +22,9 @@ rootProject.allprojects {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
buildFeatures {
buildConfig true
}
// Conditional for compatibility with AGP <4.2. // Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) { if (project.android.hasProperty("namespace")) {
namespace 'io.flutter.plugins.urllauncher' namespace 'io.flutter.plugins.urllauncher'

View File

@ -2,7 +2,7 @@ name: url_launcher_android
description: Android implementation of the url_launcher plugin. description: Android implementation of the url_launcher plugin.
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 6.0.36 version: 6.0.37
environment: environment:
sdk: ">=2.18.0 <4.0.0" sdk: ">=2.18.0 <4.0.0"