• Register
0 votes

Problem  :

Currently I am learning Ionic I have recently created the ionic 2 project and also added the diagnostic cordova plugin as below:

ionic plugin add cordova.plugins.diagnostic

npm install --save @ionic-native/diagnostic

and after that added the android platform  as below :

ionic platform add android@latest

Now I am trying to build it with ionic build android console but it gives me below error :

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

How to fix above error?

8 4 2
2,300 points

1 Answer

0 votes

Solution :

I know such errors are really hard to fix for beginners.

If you are windows user then you can follow below procedure to fix it.

At the beginning you need to download the Gradle binary.

After downloading just extract your zip file to 'C:\Gradle' or your preferred folder

Then you need to open the edit environment variable dialog from your start menu > Search

Now click on 'New' under your system variables and then add as below

The Variable Name GRADLE_HOME and Variable Value C:\Gradle\gradle-4.0.1

After that you can choose PATH variable from your system variable list

Then you need to append your gradle path to variable value as follows C:\Gradle\gradle-4.0.1\bin

Now press the win Key+R and type cmd then enter > in the command terminal type gradle -v

If you done the setup correctly then you will see your gradle installation details.

5 2 1
4,980 points

Related questions

0 votes
2 answers 74 views
Problem : I am working on the Ionic project in Ubuntu 16.04 LTS, and now I am preparing for release. So I am running the following command: cordova build --release android But I am facing the following error: Error: Could not find gradle wrapper within Android SDK. Might need to ... .1 · I am having All Android versions from 2.1 (Eclair) to 7.1.1 (Nougat) Does anybody have any clue on this error?
asked Nov 29, 2019 alecxe 7.5k points
0 votes
1 answer 1.1K views
Problem : I am trying to learn the Android and Ionic. If I run the ionic build android command in the root of the ionic project, I am facing below error: FAILURE: Build failed with an exception. Where: Script '/home/javad/Desktop/javadApp/platforms/android/CordovaLib/cordova. ... Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
asked Feb 18 mphil 2.3k points
0 votes
1 answer 1.3K views
Problem : I cleaned my whole project by deleting my local directories as following ~/.gradle, ~/.m2 ~./android and ~/workspace/project/.gradle and choosing the File -> Invalidate Caches / Restart... in my Android Studio. Now execution of my command ./gradlew leads to the ... say that I deleted too much code, the question now is how can it be repaired again? Do you have any solution to fix this?
asked Jan 18 jwilliam 3.9k points
0 votes
1 answer 21 views
Problem: I am at the moment facing below error in my android studio after importing my Project: Error:(16, 0) Gradle DSL method not found: 'android()' Possible causes: The project 'LoginActivity' may be using a version of Gradle that does not contain the method. ... fuctionality (eg: editing, debugging) will not work properly. Please guide me to get rid of the above problem as soon as possible.
asked Sep 1 Raphael Pacheco 4.9k points
0 votes
1 answer 27 views
Problem: After installing Android Studio 3.2 on my machine I was unable to run Java. I have already tried following jdk-8u181-windows-x64, jdk-10.0.2_windows-x64_bin, jdk-11_windows-x64_bin setting the PATH and also reinstalling everything many times still the result is the ... playing with it too much I think something went very wrong.So I decided to start from fresh and still unable to fix it.
asked Aug 31 Raphael Pacheco 4.9k points