简体   繁体   English

Android Sdk 问题 Ubuntu 20.04lts

[英]Android Sdk issue with Ubuntu 20.04lts

Ubuntu only finds ANDROID_HOME when not running with sudo. Ubuntu 仅在不使用 sudo 运行时才找到 ANDROID_HOME。 When sudo is used, it does not find the installation.使用 sudo 时,找不到安装。 Please help!请帮忙!


administrator@administrator-System:~/ap_ids/app$ cordova requirements管理员@administrator-System:~/ap_ids/app$ cordova 要求

Requirements check results for android: android的需求检查结果:

Java JDK: installed 1.8.0 Java JDK:安装1.8.0

Android SDK: installed true Android SDK:已安装真实

Android target: installed android-29,android-28 Android 目标:安装 android-29,android-28

Gradle: installed /home/administrator/gradle-6.4.1/bin/gradle Gradle:安装/home/administrator/gradle-6.4.1/bin/gradle


administrator@administrator-System:~/ap_ids/app$ sudo cordova requirements管理员@administrator-System:~/ap_ids/app$ sudo cordova 要求

Requirements check results for android: android的需求检查结果:

Java JDK: installed 1.8.0 Java JDK:安装1.8.0

Android SDK: not installed Android SDK:未安装

Failed to find 'ANDROID_HOME' environment variable.找不到“ANDROID_HOME”环境变量。 Try setting it manually.尝试手动设置。

Failed to find 'android' command in your 'PATH'.未能在您的“PATH”中找到“android”命令。 Try update your 'PATH' to include path to valid SDK directory.尝试更新您的“路径”以包含有效 SDK 目录的路径。

Android target: not installed Android 目标:未安装

android: Command failed with exit code ENOENT android:命令失败,退出代码为 ENOENT

Gradle: not installed Gradle:未安装

Could not find gradle wrapper within Android SDK.在 Android SDK 中找不到 gradle 包装器。 Could not find Android SDK directory.找不到 Android SDK 目录。 Might need to install Android SDK or set up 'ANDROID_HOME' env variable.可能需要安装 Android SDK 或设置“ANDROID_HOME”环境变量。

Some of requirements check failed部分需求检查失败

Global paths should be set at /etc/profile .全局路径应设置在/etc/profile So put your export ANDROID_PATH... statement there.所以把你的export ANDROID_PATH...声明放在那里。

But why would you want to run cordova in sudo ?但是你为什么要在sudo中运行cordova呢?

Quoting : 报价

Many Linux distributions support the Linux Standard Base /etc/profile.d directory where configurations such as additional paths directives can go without touching the stock system files.许多 Linux 发行版支持 Linux 标准基础/etc/profile.d目录,其中附加路径指令等配置可以 go 而不触及库存系统文件。

cat >> /etc/profile.d/some_name.sh << \EOF
  PATH=$PATH:/path_to_android/bin
EOF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM