Reputation:
I've updated my Gradle distributionUrl to https://services.gradle.org/distributions/gradle-6.1.1-all.zip from gradle-4.1-all.zip, but when I run ionic cordova run android
it reverts itself back to the 4.1-all.zip file. This happens around the time where the terminal comes to:
ANDROID_HOME=C:\Users\me\AppData\Local\Android\SDK
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181
studio
Subproject Path: CordovaLib
Subproject Path: app
which then results in
FAILURE: Build failed with an exception.
*Where:
Build file 'C:\Users\me\Desktop\....\platforms\android\CordovaLib\build.gradle' line 40
* What went wrong:
A problem occurred evaluating project':CordovaLib'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.1.1. Current version is 4.1...
Line 40 in this case is apply plugin: 'com.android.library'
The issue I'm seeing is that the Gradle version is reverting itself back to the previous version. How can I get this to stay at version 6.1.1? Is there something wrong with the com.android.library
plugin that I should be fixing?
my gradle dependencies are:
classpath 'com.andorid.tools.build:gradle:4.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
my ionic info
:
cli packages: (C:\Users\bg21562\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.3
ionic (Ionic CLI) : 3.20.1
global packages:
cordova (Cordova CLI) : 9.0.0 ([email protected])
local packages:
@ionic/app-scripts : 3.2.4
Cordova Platforms : android 7.1.4
Ionic Framework : ionic-angular 3.9.9
System:
Android SDK Tools : 26.1.1
Node : v8.11.3
npm : 6.11.3
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\Bg21562\AppData\Local\Android\SDK
Misc:
backend : pro
Upvotes: 2
Views: 3354
Reputation:
Gradle versions are located in several locations, as it turns out.
In order to fix this, I found the distributionUrl as a variable in the following locations:
platforms\android\cordova\lib\builders\StudioBuilder.js
and platforms\android\cordova\lib\builders\GradleBuilder.js
Both of these files include
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-4.1-all.zip';
which of course, needed to be replaced with 6.1.1-all.zip
Make sure to also replace the gradle-wrapper.properties file with the 6.1.1 gradle version.
I also found an option to add an export variable for CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL into the bash profile:
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=http\\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Best answers found here: Cordova build changes distributionUrl in gradle-wrapper.properties file
Upvotes: 6