How to use cli tools for Android SDK in linux terminal?

  android, command-line-interface, linux, sdk, terminal

I was working on kivymd project and after completing it I wanted it to deploy on an android device. To do that you need to use buildozer that works with python-for-android (p4a). I have installed buildozer on my linux system (Ubuntu 20.04.3 LTS). After running the first command buildozer init and editing the buildozer.spec file I ran the next command buildozer -v android debug to start debugging my kivymd program and eventually will generate an apk file in the bin directory.

The first time debugging is very time consuming because at first it downloads and installs all the necessary files like Android NDK, SDK, etc. During that process I faced an error: API27 not found. Please use SDK Manager to install required APIs. I searched for sdk manager in my .buildozer/android/platform/android-sdk/tools/bin but don’t know how to use it exactly to install the required android-api27.

Every other answer I found suggested to use SDK manager from Android Studio but no answer on how to exactly use cli tools for SDK manager. Google provides us an option to download sdk command line tools instead of downloading the android studio but no reference on how to use that command line tools to install any packages or apis.

Source: Android Questions