Reputation: 1302
Is there a way to setup gradle version for cordova project in visual studio?
build.gradle file contains the following string:
classpath 'com.android.tools.build:gradle:1.5.0'
But I need:
classpath 'com.android.tools.build:gradle:2.1.0'
Upvotes: 5
Views: 17152
Reputation: 83
An alternative to andreszs solution is to modify platforms\android\cordova\lib\builders\GradleBuilder.js
:
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || http\\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Upvotes: 1
Reputation: 2956
For anyone else interested in updating the Gradle version used by Cordova, create this system environment variable:
CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
https://services.gradle.org/distributions/gradle-3.5-all.zip
To use a different version, get the proper link from here.
For complete guide see Upgrading Gradle for Cordova mobile apps in Windows
Upvotes: 10
Reputation: 6973
No. We do not directly expose this setting in our tools. However, you can manually configure the platform to use a different version of Gradle. Please see the Apache documentation, here:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/
(Disclosure: I work on the tools for apache Cordova in visual studio at Microsoft)
Upvotes: 4