Nativescript CLI 说 Android SDK 配置不正确,但我不知道如何修复它

Nativescript CLI says Android SDK not configured properly, but I don't know how to fix it

我正在开发 Nativescript 应用程序,并希望通过 USB 运行 在我的 Android 物理设备(Huawei P10 lite)上使用它。

我下载了 Android SDK CLI 工具并将其解压缩到我的 ~/Android/ 目录中,并将我的环境变量 ANDROID_HOME 设置为 /home/<username>/Android。当我 运行 tns run android 我希望应用程序在我的 phone 上启动时,但是它打印出来:

✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different  operating system, you can use the NativeScript cloud infrastructure.
✖ WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK 
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

Your environment is not configured properly and you will not be able to execute local builds.

没有迹象表明具体配置不正确。所以我不知道接下来应该尝试什么?

我 运行 宁 Ubuntu 18.04.5。我的 ~/Android/ 目录看起来像

-rwxr--r-- android
drwxr-xr-x bin/
drwxr-xr-x build-tools/
-rwxr--r-- emulator
-rwxr--r-- emulator-check
-rw-r--r-- .knownPackages
drwxr-xr-x lib/
drwxr-xr-x licenses/
-rwxr--r-- mksdcard
-rwxr--r-- monitor
-rw-r--r-- NOTICE.txt
drwxr-xr-x platforms/
drwxr-xr-x platform-tools/
drwxr-xr-x proguard/
-rw-r--r-- source.properties
drwxr-xr-x support/

我已经为 adb -> /home/<username>/Android/platform-tools/adbemulator -> /home/<username>/Android/platform-tools/emulator 设置了符号链接,并将链接放在 ~/.bin/ 目录中。搜索终端命令时会检查此目录,我可以通过这种方式从任何目录成功 运行 它们。

经过一番挖掘,我发现了问题所在。下载的 Android CLI 工具被提取到我的顶级 ~/Android/ 目录中。 CLI 工具实际上应该放在~/Android/tools/ 目录 中。进行此更改后,tns doctor 没有发现任何问题,我可以 运行 tns run android 成功。

我的 ~/Android/ 目录结构现在如下所示:

build-tools/
.knownPackages
licenses/
platforms/
platform-tools/
tools/

~/Android/tools/ 目录现在如下所示:

android
bin/
emulator
emulator-check
lib/
mksdcard
monitor
NOTICE.txt
proguard/
source.properties
support/

Part of the android setup that I missed 它说

The archive you just extracted was the tools folder, so in this case it would be at: /usr/local/android/sdk/tools

在我的例子中 /usr/local/android/sdk~/Android