How To: Fix Error: Could not find an installed version of Gradle — osX macOS

Problem: “Error: Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper. Please include gradle in your path, or install Android Studio”

My problem was also that the path wasn’t available system wide, I could say $gradle -v” in some terminals but not all, the solution below fixed this issue. This problem was happening when I was trying to build an Ionic App for android, I had Android Studio installed as well.

Solution for mac :

  • Manually install gradle
    • Download latest version of gradle
    • Create a directory
      • $ mkdir /opt/gradle
    • Unzip contents into this directory
      • $ unzip -d /opt/gradle gradle-4.4-bin.zip
    • Make sure contents are there
      • $ ls /opt/gradle/gradle-4.4
  • Set Environment Variables
    • Create the file (~/.bash_profile) if not already there
      • vim ~/.bash_profile
    • Add this line of text
      • export PATH=$PATH:/opt/gradle/gradle-4.4/bin
    • Source the file
      • $ source ~/.bash_profile