I am currently working on an Ionic 3.4 project and trying to build it for Android testing.
Following the installation of Android Studio, the Android SDK, and Java 8, I proceeded with the command:
ionic cordova platform add android
However, when I attempt to run...
ionic build android
...an error occurs:
cordova build android ✖ Running command - failed!
[ERROR] Cordova encountered an error. For more information, try running the Cordova command directly above.
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=C:\Users\Zerok\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_121 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
I have also installed Gradle 4.0 into the Java folder and set the GRADLE_HOME environment variable as follows:
Var name: GRADLE_HOME
Value: C:\Program Files\Java\gradle-4.0
In addition, I added the following to the path:
GRADLE_HOME\bin
Despite these steps, I continue to encounter the same error. It seems like a potential issue within the Ionic/Cordova build system rather than related to plugins. I am puzzled by the requirement of Gradle when Android Studio is functioning correctly. Could this be due to differences in disk locations? Any suggestions would be appreciated.