Dan890 commented on issue #1801:
URL:
https://github.com/apache/cordova-android/issues/1801#issuecomment-3022823325
Hi, I ran into the exact same issue and wanted to share what I found — and
how I solved it.
Cordova Android uses a JSON config file — cdv-gradle-config.json — that
defines the Gradle version like so:
"GRADLE_VERSION": "8.9"
This version is then used inside build.gradle to create the Gradle wrapper
with:
task wrapper(type: Wrapper) {
gradleVersion = cordovaConfig.GRADLE_VERSION
}
However, the wrapper file (gradle-wrapper.properties) is not always
regenerated automatically. So if you previously added cordova-android@14 (which
might’ve pulled Gradle 8.9), and then downgraded to @13, the config file might
still refer to a newer Gradle version — even though the wrapper on disk is
older (e.g., 8.4 or 7.6.5).
My Solution
platforms/android/gradle/wrapper/gradle-wrapper.properties
⚠️ If it doesn't exist (this happened to me):
You need to manually create the folder and the file:
Create directory:
platforms/android/gradle/wrapper/
Create file: gradle-wrapper.properties
With this content (adjust version as needed):
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Once I did this, the build worked fine again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]