cordova Android requirements failed: “Could not find an installed version of Gradle”

前端 未结 17 914
旧时难觅i
旧时难觅i 2020-11-27 03:44

I\'m trying to build a Cordova Android project using the most recent tools. I followed the instructions here:

$ cordova create myApp com.myCompany.myApp myAp         


        
17条回答
  •  独厮守ぢ
    2020-11-27 04:27

    Solution for linux and specifically Ubuntu 20:04. First ensure you have Java installed before proceeding:

    1. java -version
    2. sudo apt-get update
    3. sudo apt-get install openjdk-8-jdk
    

    Open .bashrc

    vim $HOME/.bashrc 
    

    Set Java environment variables.

    export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
    export JRE_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre"
    

    Visit Gradle's website and identify the version you would like to install. Replace version 6.5.1 with the version number you would like to install.

     1. sudo apt-get update
     2. cd /tmp && curl -L -O https://services.gradle.org/distributions/gradle-6.5.1-bin.zip
     3. sudo mkdir /opt/gradle
     4. sudo unzip -d /opt/gradle /tmp/gradle-6.5.1-bin.zip
    

    To setup Gradle's environment variables use nano or vim or gedit editors to create a new file:

    sudo vim /etc/profile.d/gradle.sh
    

    Add the following lines to gradle.sh

    export GRADLE_HOME="/opt/gradle/gradle-6.5.1/"
    export PATH=${GRADLE_HOME}/bin:${PATH}
    

    Run the following commands to make gradle.sh executable and to update your bash terminal with the environment variables you set as well as check the installed version.

    1. sudo chmod +x /etc/profile.d/gradle.sh
    3. source /etc/profile.d/gradle.sh
    4. gradle -v
    

提交回复
热议问题