Ionic 4, Android Studio, Gradle, Java jdk or Cordova error

Issue

I am trying to test if the qr-scanner for my Ionic 4 app is working so I need to test my application on an android device (tablet).
I used the command: ionic cordova run android in my Visual Studio Code command prompt but I keep getting errors. My latest error is:

cordova.cmd run android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Me\AppData\Local\Android\Sdk (DEPRECATED)
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
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd run android exited with exit code 1.
Re-running this command with the –verbose flag may provide more information.

I have downloaded/installed and configured Android Studio, Java jdk, Gradle and Cordova as all the solutions I have tried suggests but I keep getting more errors as I progress. Even after setting the user environmental variable ANDROID_HOME and system environmental variable PATH and restarting my computer.

Solution

Your problem is most likely that you are not running your Visual Studio Code as Admin.
So it cannot access the displayed paths.

Regards,
Markus

Answered By – markus buitendag

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published