Cordova / Ionic build android Gradle error: Minimum supported Gradle version is 2.14.1. Current version is 2.13

前端 未结 8 1292
北荒
北荒 2021-02-02 07:34

This is a solution to the above error that I want to document. I found other similar posts, but none described how this error can be associated with Cordova or Ionic.

I

相关标签:
8条回答
  • 2021-02-02 08:14

    you can change the value in platform/android/cordova/lib/builders/GradleBuilder.js

    the value you changed, it will be replaced by the lastest gradle zip when you reinstall android platform, so you don't need to worry about change it

    var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip';
    

    or like the others ans

    export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\://services.gradle.org/distributions/gradle-2.14.1-all.zip"
    
    0 讨论(0)
  • 2021-02-02 08:15

    Switching back to "Use default gradle wrapper" didn't work for me on my ionic 1 project, but running

    ionic platform remove android
    ionic platform add android
    

    Worked for me

    0 讨论(0)
  • 2021-02-02 08:16

    For me, the following commands solved the problem:

    cordova platform remove android
    
    cordova platform add android
    
    ionic build android
    
    0 讨论(0)
  • 2021-02-02 08:26

    In follow up to Chuck Holbrooks answer, with following solution I get an error when trying to add android platform again saying it is already added.

    ionic cordova platform remove android
    ionic cordova platform add android
    

    My working Solution:

    ionic cordova platform remove android
    ionic cordova platform check android
    ionic cordova platform add android 
    
    0 讨论(0)
  • 2021-02-02 08:30

    Another way to fix issue, that also works on Windows:

    cordova build android --release --CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
    
    0 讨论(0)
  • 2021-02-02 08:33

    I'd love to just leave this as a comment, but I'm apparently not reputable enough...

    After reading your documentation, I wasn't able to resolve my issue with your suggestion of keeping the Android Studio to "Use default gradle wrapper". What I did find is that setting the session variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL before building got me a bit further:

    root@dev:$ export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\://services.gradle.org/distributions/gradle-2.14.1-all.zip"
    root@dev:$ cordova build android
    

    The next thing I had to do was edit <project>/platforms/android/build.gradle and <project>/platforms/android/CordovaLib/build.gradle and make sure they both pointed to a valid gradle plugin version.

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
    }
    

    ...and in <project>/platforms/android/CordovaLib/build.gradle I added jcenter in the repositories (because maven.org did not seem to have 2.2.0)

    repositories {
        mavenCentral();
        jcenter()
    }
    

    I was able to build then.

    0 讨论(0)
提交回复
热议问题