简体   繁体   English

Android缺少平台工具

[英]Android missing platform tools

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. 请有人可以帮助我这个,我有一个Ubuntu服务器(仅限终端),我已经下载了android SDK,我已经安装了java,当我在/ tools中尝试运行./android并且我得到一个错误缺少平台工具。 So how do I from terminal install the platform tools, for some reason I cant find this information anywhere. 那么我如何从终端安装平台工具,由于某种原因我无法在任何地方找到这些信息。

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

Android manager has a graphical interface. Android管理器有一个图形界面。 But it can also be used via command line for some cases. 但在某些情况下也可以通过命令行使用它。

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上:你可以在$PATH添加android工具:

Lets say sdk directory is /home/user/sdk then: 让我们说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+O and then CTRL+X ) 并保存( CTRL+O然后CTRL+X

Logout and login again, run from terminal: 注销并再次登录,从终端运行:

echo $PATH

to verify. 核实。

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

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