Ionic-v6 Cordova build errors

I have followed all the instructions mentioned here Android App Development Guide: Build Ionic Apps in Android Studio for Android development on my MAC.

But I am getting below error

> cordova build android

Checking Java JDK and Android SDK versions

ANDROID_SDK_ROOT=undefined (recommended setting)


Using Android SDK: /Users/akhileshsrivastava/Library/Android/sdk

Subproject Path: CordovaLib

Subproject Path: app

FAILURE: Build failed with an exception.

* Where:

Script '/Users/akhileshsrivastava/Documents/akhilapps/demoapp/platforms/android/CordovaLib/cordova.gradle' line: 69

* What went wrong:

A problem occurred evaluating script.

> No installed build tools found. Install the Android build tools version 30.0.3 or higher.

* Try:

Run with **--stacktrace** option to get the stack trace. Run with **--info** or **--debug** option to get more log output. Run with **--scan** to get full insights.

* Get more help at ****

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


**BUILD FAILED** in 813ms

Command failed with exit code 1: /Users/akhileshsrivastava/Documents/akhilapps/demoapp/platforms/android/gradlew cdvBuildDebug -b /Users/akhileshsrivastava/Documents/akhilapps/demoapp/platforms/android/build.gradle

[ **ERROR** ] **An error occurred while running subprocess** **cordova** **.**

cordova build android exited with exit code 1.

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

I did have installed Java 1.8, latest android studio with all required sdk and emulator, gradle etc. But still not sure where I am doing wrong. Please help!

I finally resolved this by installing 30.0.3 build tools from SDK tools of android studio.