Cannot Build Android APK - IONIC 4

I has installed jdk 8 and latest android studio, gradle and i also set environment variable for java_home ,android_home,gradle_home but showing this error

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\A-11\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 build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

i cannot build the android apk, Any one help…

Solution is here

I already installed gradle by own. but still i have facing this problem

ANDROID_SDK_ROOT should be defined. For Mac:

vim ~/.bash_profile

add this (your path to sdk) to bash_profile

export ANDROID_SDK_ROOT=/Users/XXX/Library/Android/sdk

then run

source ~/.bash_profile


hi! i am having same issue on windows. pls any help?