ionic 2 - Error Could not find an installed version of Gradle either in Android Studio
Try installing gradle and include it into your path. Click the link below to get manual.
https://gradle.org/install
cordova Android requirements failed: Could not find an installed version of Gradle
Solution for linux with apt-get (eg.: Ubuntu, Debian)
I have quite similar problem. I obtained 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 Studi
but without Exception. I solved it on Ubuntu by
sudo apt-get install gradle
I found also commands that allows install newest version of gradle in Ubuntu. It works only when first command is executed before (probably some dependecies are incorrect).
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle-ppa
https://wtanaka.com/node/8079
If it does not work, try:
export PATH=$PATH:/opt/gradle/gradle-3.5/bin
More info:
https://askubuntu.com/questions/915980/package-is-installed-and-is-not-detected-gradle/915993#915993
For CentOS
Instruction of instalation gradle
for CentOS is under this link
https://gist.github.com/parzonka/9371885
Update
Now I installing gradle by sdkman it is something like nvm for node.
Install sdkman
curl -s "https://get.sdkman.io" | bash
Install gradle
sdk install gradle 4.0.2
Ionic Angular & Android Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper
Assuming ANDROID_HOME
& ANDROID_SDK_ROOT
are all set.
The problem is with jdk 16
.
We have to uninstall jdk 16
and install jdk 8
.
After that, add the jdk path into the environment variable.
- In Admin part, click new => name it "
JAVA_HOME
" and input the path. - In System variable part, click new => name it "
JAVA_HOME
" and input the path. - In System variable part, click on '
path
' => click 'edit
' => then add%JAVA_HOME%\bin
Then you might see some problem with the gradle
.
So go to https://gradle.org/install/
Then follow the "Installing manually" section.
- Download gradle, which will be in zip file
- Create a folder called Gradle
- Extract
gradle.zip
into Gradle folder.
In System variable part, click on 'path
' => click 'edit
' => then add C:\Gradle\gradle-6.8.3\bin
Ionic_CordovaError: Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper
finally i got the solution of my own question.
If you have already installed Android Studio and set the Environment variable like,
ANDROID_HOME : /Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk
Then you need to download the gradle and include it into your path. Click the link below to get manual. https://gradle.org/install
Once download completed, follow the below steps:
Step-1: Goto your sdk path. here is my path /Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk/tools
Step-2: create a new folder named as "gradle" and open it.
Step-3: Unzip the gradle folder here which was downloaded earlier.
Step-4: Now open terminal and run your ionic project.
Cordova Build - Could not find an installed version of Gradle
I finally figured it out.
Some of the files in the project were locked, owned by root. When I used just
cordova build android
an error message popped up saying that some file can't be read.
Therefore, when building, I used
sudo cordova build android
.
That helped me to get rid of the permission problem but it also was the actual cause of the problem with Gradle...
...when a command is run with sudo
the $PATH
variable used is different (restricted). In my case, this is the value that was used when building without sudo
:
/home/viktor/.sdkman/candidates/gradle/current/bin:/home/viktor/bin:/home/viktor/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/viktor/Android/Sdk/tools:/home/viktor/Android/Sdk/tools/bin:/home/viktor/Android/Sdk/platform-tools:/snap/bin
And this is $PATH
with sudo
:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
As you may see, the latter is missing the path to Gradle.
So, the solution here was to chmod
and chown
the project files and build without sudo
just using
cordova build android
.
Related Topics
Android Calling Asynctask Right After an Another Finished
How to Change Color of Listview Items on Focus and on Click
Generating Google Map Release API Key
Difference Between Content_Main.Xml and Activity_Main.Xml
How to Draw Outside the Bounds of an Android Canvas
Project Has No Default.Properties File! Edit the Project Properties to Set One
Retrofit2.0 Gets Malformedjsonexception While the JSON Seems Correct
How to Communicate Between Activities
How to Attach Image from Drawable to Gmail
Packaging Android Resource Files Within a Distributable Jar File
How to Change the Color of the Tabs Indicator Text in Android
Android Emulator Won't Run Application Started from Eclipse
Inserting Contacts in Android 2.2
Android Gradle Build Error:(9, 0) Gradle Dsl Method Not Found: 'Compile()'
Crashlytics Android Sdk - Custom Uncaughtexceptionhandler
Android/Java: Transition/Migration from Proguard to R8
Could Not Find Com.Android.Tools.Build:Gradle:4.0.1 ( or Any Version )
"You Need to Use a Theme.Appcompat Theme (Or Descendant) with the Design Library" Error