gpt4 book ai didi

android - 在 ubuntu 机器上为 nativescript 配置 android sdk 的问题

转载 作者:行者123 更新时间:2023-11-29 22:35:10 25 4
gpt4 key购买 nike

我注意到没有快速的方法在 linux 上安装和配置所有 nativescript 依赖项,比如 windows 和 mac,所以我遵循了 linux 的高级设置指南并且所有命令都成功运行,然而,当运行 tns doctor 它告诉我 android sdk 未安装或配置不正确。其他一切都给我绿色复选标记这是我做的

  1. 下载安卓SDK
  2. 解压到/usr/local/android/sdk/
  3. 将 java 版本改回 8,因为我安装了 10 版
  4. 运行 sudo sdkmanager "tools", sudo sdkmanager "build-tools"
  5. 确保无需 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/

最佳答案

查看此链接以了解 ubuntu 系统中的 nativescript 设置。因为我已经按照该链接进行设置。 https://docs.nativescript.org/start/ns-setup-linux .重点关注android sdk安装的第5步和~/.bashrc文件中环境变量中设置的anroid sdk路径。

关于android - 在 ubuntu 机器上为 nativescript 配置 android sdk 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59553932/

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