【发布时间】:2020-01-01 15:58:23
【问题描述】:
我注意到在 Windows 和 mac 等 linux 上安装和配置所有 nativescript 依赖项没有快速的方法,所以我遵循了 linux 的高级设置指南,并且所有命令都成功运行,但是,在运行 tns doctor 时它告诉我没有安装或未正确配置android sdk。其他一切都给了我绿色的复选标记
这就是我所做的
- 下载安卓sdk
- 解压到 /usr/local/android/sdk/
- 将 java 版本改回 8,因为我安装了版本 10
- 运行
sudo sdkmanager "tools"、sudo sdkmanager "build-tools"等 - 确保无需 sudo 即可访问 sdkmanager 命令
但它不起作用,我不知道为什么。任何帮助,请提前致谢。
这是tns doctor的输出
✔ Getting environment information
There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.3.0 version and is up to date.
✔ 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
You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Sync to Playground" to enjoy NativeScript without any local setup. All you need is a couple of companion apps installed on your devices.
Select "Configure for Cloud Builds" to install the nativescript-cloud extension and automatically configure your environment for cloud builds.
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.
编辑: 这是我添加到 ~/.bashrc 文件中的行。
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
export ANDROID_HOME="/usr/local/android/sdk"
export PATH="$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/tools/bin"
这里也是$ sdkmanager --list输出的第一部分
Warning: File /home/mahmoud/.android/repositories.cfg could not be loaded.
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;28.0.3 | 28.0.3 | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/
extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/
extras;google;m2repository | 58 | Google Repository | extras/google/m2repository/
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/
platform-tools | 29.0.5 | Android SDK Platform-Tools | platform-tools/
platforms;android-28 | 6 | Android SDK Platform 28 | platforms/android-28/
tools | 26.1.1 | Android SDK Tools 26.1.1 | tools/
【问题讨论】:
-
您是否打开了 SDK 管理器并安装了所需的/最新的包和 API 级别?
-
@Manoj 如果您的意思是我的问题中的第四步,那么是的,我做到了。请注意,我安装了 sdk,但没有安装 android studio
标签: android linux configuration sdk nativescript