ionic-framework: 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
Ionic version:
[x] 3.x
I’m submitting a …
[x ] bug report
Current behavior:
ionic run android --prod results in below 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
Expected behavior:
ionic run android --prod must build and run on device connected
Ionic info:
Cordova CLI: 7.0.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.10.1
Xcode version: Xcode 8.2.1 Build version 8C1002
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (3 by maintainers)
On
cordova@7.0.0andSDK Tools 26.x.xyou have to installgradleby your own.If you have an debian/ubuntu system you can do this like that
sudo apt-get install gradlegoogle how to install gradle on Mac! 😄
Run this command to install gradle on a mac:
brew update && brew install gradle@mburger81 - how to get this on Mac OS? I don’t have Android Studio Installed
Here is the solution I found for Mac
Download the Gradle Binary Only Distribution from https://gradle.org/gradle-download/
Open a terminal Run the following to unzip the android sdk to the Development directory that is under your user home directory
unzip ~/Downloads/gradle-3.1-bin.zip -d ~/Development Open up the vi editor and edit your bash profile. We need to add in the GRADLE_HOME environment variable
vi ~/.bash_profile To edit in vi hit i to enter edit mode and add the text below to the .bash_profile
export GRADLE_HOME=~/Development/gradle-3.1/bin Press the esc key to exit edit mode Press : (colon key) to enter command mode. type wq and press enter to save and exit vi Run the following to make the change active in your existing session
source ~/.bash_profile Test it by running
echo $GRADLE_HOME
Did you do as suggested by the error message?
You need to install Android Studio make sure it’s in your
PATH.Here’s my
PATHfor example:PATH="/Users/kim/.node/bin:/usr/local/bin:/usr/local/sbin:~/bin:/Users/kim/Library/Android/sdk/platform-tools:/Users/kim/Library/Android/sdk/tools:/Users/kim/Library/Android/sdk/build-tools/22.0.1:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"Thanks to @bitjson I could configure the .bash_profile to be:
And this command (I was gettind EACCESS error):
sudo chmod a+x "/Applications/Android Studio.app/Contents/gradle/gradle-4.4/bin/gradle"I could
ionic cordova run androidmy app!(Mac OS X + Ionic + NodeJS = last versions)
This issue shouldn’t be closed, the issue is still present using the latest Android Studio, cordova and ionic
What to do on windows ?!
On macOS, if you’d prefer to avoid installing an extra copy of Gradle, you can simply use the tooling installed by Android Studio by adding the following to your
~/.bash_profile(or equivalent):Note: in the future, you’ll likely need to change the version above from
gradle-4.4. To check the version you have installed, just:ls /Applications/Android\ Studio.app/Contents/gradle/For me this happened because I upgrade Cordova to version
7.0and gradle version had to be upgraded to4.0. I upgraded withbrew update && brew install gradeon MacOS. https://gradle.org/install/gradle@4.4 (install sdkman,
sdk install gradle 4.4)working for cordova android@7.1.0Same issue here.
Run: brew install gradle
This issue is closed currently, but it still does not seem to work without explicit installation of Gradle. In my case I have:
This setup works smoothly for Android native apps development (via Android Studio) but I am still getting error when trying to build ionic based project when trying to compile it with
cordova compile android --debug:My
ionic infooutput:export GRADLE_HOME=“/usr/local/lib/gradle-4.6/bin” export PATH=“$PATH:$ANDROID_HOME:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$GRADLE_HOME”
I am using Linux Mint 18 Cinnamon and was experiencing the same problem. The problem was happening even though I have an ionic 1 setup and Android that is building with no issues.
I resolved it by installing gradle
sudo apt-get install gradleGradle was automatically added to the PATH and the various ionic build commands worked without a hitch.ionic info: