Repository navigation
fix(android): avoid implicit parent project property lookup deprecated in Gradle 9 - #8731
Merged
Merged
Conversation
…d in Gradle 9
The library build.gradle files read app overrides with
project.hasProperty('x') ? rootProject.ext.x : default. hasProperty() on a
subproject only finds the value by falling back to the root project, which
Gradle 9 deprecates and Gradle 10 will turn into an error.
Call hasProperty() on rootProject instead, which is where the value is read
from anyway. Same for the cdvMinSdkVersion line the CLI writes to
cordova.variables.gradle.
andredestro
requested review from
ItsChaceD,
OS-pedrogustavobilro,
alexgerardojacinto,
jcesarmobile,
markemer and
theproducer
November 19, 2026 16:08
alexgerardojacinto
approved these changes
Nov 19, 2026
This was referenced Nov 19, 2026
Member
|
This also should fix: https://outsystemsrd.atlassian.net/browse/RMET-5590 |
markemer
approved these changes
Nov 19, 2026
andredestro
deleted the
fix/RMET-5591/gradle-implicit-property-lookup
branch
November 20, 2026 11:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Gradle 9.8, an app shows "Implicit lookup of properties in parent projects has been deprecated. This will fail with an error in Gradle 10." for Capacitor's own build files, once per variable the app sets in
variables.gradle.The library
build.gradlefiles read overrides withproject.hasProperty('x') ? rootProject.ext.x : default. Called on the subproject,hasProperty()only findsxby falling back to the root project, and that fallback is what Gradle deprecated. The warning only shows up inside an app, because the library repo itself never defines these variables.This PR calls
hasProperty()onrootProject, which is where the value is read from anyway, so the behavior is the same:android/capacitor/build.gradle(11 lines)android/capacitor-cordova/build.gradle(4 lines)capacitor-cordova-android-plugins/build.gradle, the template the CLI copies into apps (4 lines)cli/src/android/update.ts, thecdvMinSdkVersionline written tocordova.variables.gradle, which is applied from:appChange Type
Rationale / Problems Fixed
https://outsystemsrd.atlassian.net/browse/RMET-5591
https://docs.gradle.org/9.8.2/userguide/upgrading_version_9.html#deprecated_implicit_lookup_in_parent_projects
Platforms Affected
Tests
App: capacitor-testapp plus one Cordova plugin (
cordova-plugin-device), so the two Cordova modules are included. Gradle 9.8.2,./gradlew assembleDebug --warning-mode all.@capacitor/androidlinked to this branch andcap sync androidrun with this branch's CLI, so the generated files come from the new code.capacitor/build.gradlecapacitor-cordova/build.gradlecapacitor-cordova-android-plugins/build.gradlecordova.variables.gradlecapacitor-plugins(not in this PR)App overrides still apply.
variables.gradleset values that differ from the library defaults, and an init script printed the effective values for:app,:capacitor-android,:capacitor-cordova-androidand:capacitor-cordova-android-plugins. They are the same before and after:minSdk=27(default 26),cdvMinSdkVersion=27,cordovaAndroidVersion=15.0.0(default 15.1.0),androidxAppCompatVersion=1.7.1(default 1.8.0).compileSdkis not covered by this check, because the app uses the same value as the default.With Gradle 9.5.1 there are no warnings either before or after.
npm test -w clipasses (507 tests).prettier --checkandeslintpass onupdate.ts. I did not runnpm run verify -w androidlocally; CI covers it.Notes / Comments
The same lines exist on
next. The plugins incapacitor-pluginsand the plugin template increate-capacitor-pluginuse the same pattern and will get separate PRs.