NativeScript 安装问题
Posted
技术标签:
【中文标题】NativeScript 安装问题【英文标题】:NativeScript Installation Issues 【发布时间】:2017-03-08 02:21:08 【问题描述】:我只是想安装 NavtiveScript,为此我遵循了官方安装指南,可在
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install ios and android requirements"
当我在命令提示符中运行以下命令时(具有管理权限)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
一切似乎都安装了,没有任何问题。但是当我尝试通过命令验证安装时,“tns doctor”会返回以下警告:
D:\>tns doctor
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android to manage your Android SDK versions.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=24'.
Run android from your command-line to install required Android Build Tools.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android to manage the Android Support Repository.
谁能指导一下?
我使用的是 Windows 10,并在我的机器上安装了 Visual Studio 2015(更新 3)和 Visual Studio Code。
【问题讨论】:
为此做好准备。安装 Chocolatey 时出现错误,因此脚本无法继续安装 jdk 和 android sdk。还是没有答案 【参考方案1】:安装 Android 的命令行也对我不起作用,并给了我和你一样的错误。我通过下载和安装 Android Studio 发现了这一点。安装后,您应该能够找到 android sdk 的位置,在我的情况下是 /Users/myMacUserName/Library/Android/sdk。您可以通过 SDK Manager 选择所有需要的东西。然后在终端中执行“export ANDROID_HOME=/Users/myMacUserName/Library/Android/sdk”,而不是 NativeScript 安装指令“export ANDROID_HOME=/usr/local/opt/android-sdk”中的命令。毕竟,您应该可以接受 Android SDK 错误。
【讨论】:
非常感谢!作者应该给你“解决方案” 确保在再次运行 tns doctor 之前关闭或重新启动命令行终端 我仍然有这个问题......无论我尝试什么,我总是得到“你需要在你的系统上安装 Android SDK Build-tools。你可以安装任何版本以下范围:'>=23 【参考方案2】:https://developer.android.com/studio/index.html
从上面的链接安装 android studio,然后运行 studio 并从 studio 中安装所需的 android sdk 包。
【讨论】:
我试过这个,但它不起作用。运行 tns doctor 仍然返回错误。 您必须设置 PATH 变量以指向 SDK。 看看@Becky Wu 的回答,对我有用!以上是关于NativeScript 安装问题的主要内容,如果未能解决你的问题,请参考以下文章
NativeScript Sidekick - 需要 CLI(版本 5.1.1)
如何使用 Angular 在 NativeScript 中使用 XML 而不是 Html 进行设计?