Reputation: 3592
I am working on a Cordova app and trying to change values in the cdv-gradle-condig.json but it keeps return to default whenever i run the app from command line:
cordova run android
Especcially I am trying to update the AGP_VERSION as it seems to be the app gradle's plugin version
{
"MIN_SDK_VERSION": 22,
"SDK_VERSION": 30,
"GRADLE_VERSION": "7.1.1",
"MIN_BUILD_TOOLS_VERSION": "30.0.3",
"AGP_VERSION": "4.2.2", <--//How can I change this??
"KOTLIN_VERSION": "1.6.10",
"ANDROIDX_APP_COMPAT_VERSION": "1.3.1",
"ANDROIDX_WEBKIT_VERSION": "1.4.0",
"GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.8",
"IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
"IS_GRADLE_PLUGIN_KOTLIN_ENABLED": true
}
dependencies {
// Android Gradle Plugin (AGP) Build Tools
classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
}
In addition, I also try to update gradle distribution url from gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-bin.zip
If I change the values manually and run the app from AndroidStudio it stays, but from command line it just returns to default and the build fails!
Upvotes: 3
Views: 7715
Reputation: 51
The AGP version or AndroidGooglePlugin can be specified in config.xml through AndroidGradlePluginVersion preference. i.e:
<preference name="AndroidGradlePluginVersion" value="7.2.2" />
HTH
Upvotes: 5
Reputation: 17
edit cdv-gradle-config-defaults.json
in
cordova/node_modules/cordova-android/framework/
Upvotes: 0