ANDROID_SDK_ROOT=undefined (recommended setting) (updated)

l am try to build android app on Mac os Catalina . When i run this command : sudo ionic cordova build android l have following issue :

ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/macbook/Library/Android/sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 14.0.1
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

ionic info :

 Ionic CLI                     : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli)
  Ionic Framework               : @ionic/angular 5.2.2
  @angular-devkit/build-angular : 0.901.9
  @angular-devkit/schematics    : 9.1.9
  @angular/cli                  : 9.1.9
  @ionic/angular-toolkit        : 2.2.0


  Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
  Cordova Platforms : none
  Cordova Plugins   : no whitelisted plugins (0 plugins total)


  cordova-res : 0.15.1
  native-run  : 1.0.0


  ios-deploy : 1.10.0
  ios-sim    : 8.0.2
  NodeJS     : v12.18.1 (/usr/local/bin/node)
  npm        : 6.14.5
  OS         : macOS Catalina
  Xcode      : Xcode 11.5 Build version 11E608c

Ionic Requirements

Requirements check results for android:
Java JDK: installed 14.0.1
Android SDK: installed true
Android target: installed android-30,android-29,android-28,android-27,android-26,android-25,android-24,android-23,android-22,android-21,android-20,android-19,Google Inc.:Google APIs:19
Gradle: not installed 
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

Requirements check results for ios:
Apple macOS: installed darwin
Xcode: installed 11.5
ios-deploy: installed 1.10.0
CocoaPods: not installed 
CocoaPods was not found. Please install version 1.0.1 or greater from
Some of requirements check failed

.bash_profile :

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_HOME=/Users/dylan/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/dylan/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/dylan/.android/avd
export PATH=${PATH}:/$ANDROID_HOME/platform-tools:/$ANDROID_HOME/tools:/$ANDROID_HOME/tools/bin
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_AVD_HOME=~/.android/avd
export GRADLE_HOME=~/Development/gradle-6.5.1/bin

Java version :

openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+14)
OpenJDK 64-Bit Server VM (build 14.0.1+14, mixed mode, sharing)

Matching Java Virtual Machines :

Matching Java Virtual Machines (1):
    1.8.0_251, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

l followed and applied all answers on stackoverflow withe same my issues , but i still have same problem when i want build android app .

any idea please ?

when i edit .bash_profile i do following step . open -a TextEdit ~/.bash_profile then source ~/.bash_profile

As the error puts it comment out the ANDROID HOME path by adding a hash or completely remove it. Read more

# export ANDROID_HOME=/Users/dylan/Library/Android/sdk

Leave ANDROID SDK ROOT as is and run

source ~/.bash_profile

You may have to close and open the terminal or even reboot for the path settings to take effect.