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)
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.
Your problem is most likely that you are not running your Visual Studio Code as Admin.
So it cannot access the displayed paths.
Answered By – markus buitendag