Linux Android 缺少平台工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17511431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:10:38  来源:igfitidea点击:

Android missing platform tools

androidlinuxubuntu

提问by David

Please can someone assist me with this, I have an Ubuntu server (terminal only), I have downloaded the android SDK, I have java installed, when in /tools I try to run ./android and I get an error Missing platform-tools. So how do I from terminal install the platform tools, for some reason I cant find this information anywhere.

请有人帮我解决这个问题,我有一个 Ubuntu 服务器(仅限终端),我已经下载了 android SDK,我已经安装了 java,当我在 /tools 中尝试运行 ./android 时出现错误 Missing platform-tools . 那么我如何从终端安装平台工具,由于某种原因我无法在任何地方找到这些信息。

Every resource I find assumes I have a GUI and not terminal, even ubuntu's page - https://help.ubuntu.com/community/AndroidSDK

我找到的每个资源都假设我有一个 GUI 而不是终端,甚至是 ubuntu 的页面 - https://help.ubuntu.com/community/AndroidSDK

采纳答案by S.D.

Android manager has a graphical interface. But it can also be used via command line for some cases.

Android 管理器具有图形界面。但在某些情况下,它也可以通过命令行使用。

Run with -u(no UI) option:

使用-u(无 UI)选项运行:

android update sdk -u

Accept licenses (y) and this will install/update everything required automatically.

接受许可证 ( y),这将自动安装/更新所需的一切。

To update/install selective packages only, first list packages available for install/update:

要仅更新/安装选择性软件包,请首先列出可用于安装/更新的软件包:

android list sdk -u

This will list available packages with a number index, for Example:

这将列出带有数字索引的可用包,例如:

Packages available for installation or update: 11
   1- Android SDK Platform-tools, revision 24
   2- Android SDK Build-tools, revision 24
   3- Documentation for Android SDK, API 23, revision 1
   4- SDK Platform Android N, API 24, revision 1
   5- GPU Debugging tools, revision 3.1
   6- GPU Debugging tools, revision 1.0.3
   7- Android Support Repository, revision 33
   8- Android Auto Desktop Head Unit emulator, revision 1.1
   9- Google Play services, revision 30
  10- Google Play APK Expansion library, revision 1
  11- Google Play Licensing Library, revision 1

Now you can install packages, filtering (-t) by number index to install only those:

现在您可以安装软件包,-t通过数字索引过滤 ( ) 以仅安装那些:

android update sdk -u -t 1,2


On Linux: You can add android tools to $PATH:

在 Linux 上:您可以将 android 工具添加到$PATH

Lets say sdk directory is /home/user/sdkthen:

假设 sdk 目录是/home/user/sdk

edit user's bash profile:

编辑用户的 bash 配置文件:

nano ~/.bashrc

Add following to it:

添加以下内容:

export ANDROID_HOME=/home/user/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/build-tools

and save (CTRL+Oand then CTRL+X)

并保存(CTRL+O然后CTRL+X

Logout and login again, run from terminal:

注销并再次登录,从终端运行:

echo $PATH

to verify.

验证。