'Build Android Cordova Android-Sdk Deprecated

I want to build cordova androd app, when i run cordova build, its return error:

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/adam/Library/Android/sdk (DEPRECATED)
Using Android SDK: /usr/local/Caskroom/android-sdk/4333796
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 16.0.2

My android SDK is deprecated, i have already source the sdk on my zhsrc file, but its still not working

My zhsrc file

export PATH=/Users/adam/.npm-global/lib/node_modules/@ionic/cli/bin:$PATH
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Thanks before.



Solution 1:[1]

Your Android SDK is not deprecated, but the ANDROID_HOME variable is, as explained here: https://github.com/apache/cordova-android/issues/949 In the meantime, set both variables.

You also run into the error of not matching JDK versions. Although 16.0 might be a fit, cordova looks for a version that name matches '1.8....', check yours with java -version. This took me a few hours, now I replaced Java 18 with JDK 1.8. and it works.

The answer is late but hopefully still helpful.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erdbaerchen