gpt4 book ai didi

android - Nativescript Android 模拟器未运行

转载 作者:行者123 更新时间:2023-11-29 01:00:47 27 4
gpt4 key购买 nike

自从我尝试设置我的 Android 环境已经 4 天了,但我仍然遇到一堆错误。我放弃了,我重新安装了我的 Mac OS,但仍然没有找到解决方案

我按照文档的建议安装了 nativescript,但是当我运行 tns doctor 时,出现以下错误:

✔ Getting environment information 

TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.

There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.2 version and is up to date.
✔ Component tns-core-modules has 4.1.0 version and is up to date.
✖ Component tns-android is not installed.
✖ Component tns-ios is not installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory.

✖ 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

✖ 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

✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run `$ sdkmanager` 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 <=27'.
Run `$ sdkmanager` from your command-line to install required `Android Build Tools`. In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly.

✖ You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run `$ sdkmanager` to manage the Android Support Repository. In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly.

✖ WARNING: CocoaPods is not installed or is not configured properly.
You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods.

You have nativescript-cloud extension installed, so you can execute cloud builds, but 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 "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
You have nativescript-cloud extension installed, so you can execute cloud builds, but 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 "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
? To continue, choose one of the following options: (Use arrow keys)
❯ Try Cloud Operation
Configure for Local Builds
Skip Step and Configure Manually

我检查了每个错误和每个错误中的每个 URL,但没有搞清楚。

我检查了 $ANDROID_HOME 在我的 ~/.bash_profile 以及 $JAVA_HOME 中。

我的 ~/.bash_profile 有这两条路径:

export ANDROID_HOME=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/Home

当我运行 tns doctor 并选择“Configure for Local Builds”时,它开始重新下载“Google Chrome”、“Homebrew”、“Java SE”等,即便如此我仍然遇到相同的错误。

即使我尝试指定模拟器,我也得到了与“tns doctor”命令相同的输出。

最佳答案

如果不想安装Android Studio,可以尝试关注this step-by-step setup .

在 macOS 上,根据我的经验,最好的解决方案是 install Android Studio .

之后,您可以使用 Android Studio 来管理 SDK 版本和 android 模拟器(在开发过程中更好地调试、分析和查看日志)并接受许可。

指向 Android Studio 安装的 SDK 和构建工具的环境变量(将添加到您的 bash 配置文件中)是:

export ANDROID_HOME=/Users/{{ username }}/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME

然后,重新启动计算机(否则,您可能无法从 Android Studio 启动模拟器)。重启后,打开一个终端,输入

echo $ANDROID_HOME

验证路径设置是否正确。

关于android - Nativescript Android 模拟器未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51333447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com