Search code examples
gradlecordova-android

Cordova Android build FAILED after Android Studio3.5 update


I've updated Android Studio 3.5 some days ago. BTW, I've got failed to build cordova android with the following verbose:

Could not find an installed version of Gradle either in Android Studio...

Thanks for any help.


Solution

  • I've found a solution from other stars' prior answers.

    The reason is due to missing of Gradle installation. Android Studio 3.5 doesn't update or install Gradle as its dependency so that we should install it manually.

    for Windows users

    1. Download Gradle 5.6 zip installer here.
    2. Create a new directory C:\Gradle with File Explorer.

      Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-5.6 to your newly created C:\Gradle folder.

    3. Configure your system environment.

      In File Explorer right-click on the This PC (or Computer) icon, then click Properties -> Advanced System Settings -> Environmental Variables.

      Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-5.6\bin. Click OK to save.

    4. Verify your installation

      $ gradle -v

    5. Restart your terminal and try build cordova-android again.

      It will run success.

    Thanks for attention.