欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

centos7中安装Android SDK的方法步骤

程序员文章站 2023-11-19 12:51:46
本文介绍了centos7中安装android sdk的方法步骤,分享给大家 0x01 下载sdktools cd /opt mkdir androidsd...

本文介绍了centos7中安装android sdk的方法步骤,分享给大家

0x01 下载sdktools

cd /opt

mkdir androidsdk

wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip

unzip sdk-tools-linux-3859397.zip

0x02 配置命令

打开 /opt/profile 添加sdk命令如下:

...
export path user logname mail hostname histsize histcontrol
export path=$path:/opt/androidsdk/tools/bin
...

然后执行 source profile 使之生效

0x03 查看已安装信息

sdkmanager --list

installed packages:
 path        | version | description          | location      
 -------      | ------- | -------            | -------      
 tools       | 26.0.1 | android sdk tools 26.0.1    | tools/

available packages:
 path               | version   | description           
 -------              | -------   | -------             
 add-ons;addon-g..._apis-google-15 | 3      | google apis           
 add-ons;addon-g..._apis-google-16 | 4      | google apis           
 add-ons;addon-g..._apis-google-17 | 4      | google apis           
 add-ons;addon-g..._apis-google-18 | 4      | google apis           
 add-ons;addon-g..._apis-google-19 | 20      | google apis           
 add-ons;addon-g..._apis-google-21 | 1      | google apis           
 add-ons;addon-g..._apis-google-22 | 1      | google apis           
 add-ons;addon-g..._apis-google-23 | 1      | google apis           
 add-ons;addon-g..._apis-google-24 | 1      | google apis           
 add-ons;addon-g...e_gdk-google-19 | 11      | glass development kit preview  
 build-tools;19.1.0        | 19.1.0    | android sdk build-tools 19.1   
 build-tools;20.0.0        | 20.0.0    | android sdk build-tools 20    
 build-tools;21.1.2        | 21.1.2    | android sdk build-tools 21.1.2  
 build-tools;22.0.1        | 22.0.1    | android sdk build-tools 22.0.1  
 build-tools;23.0.1        | 23.0.1    | android sdk build-tools 23.0.1  
 build-tools;23.0.2        | 23.0.2    | android sdk build-tools 23.0.2  
 build-tools;23.0.3        | 23.0.3    | android sdk build-tools 23.0.3  
 build-tools;24.0.0        | 24.0.0    | android sdk build-tools 24    
 build-tools;24.0.1        | 24.0.1    | android sdk build-tools 24.0.1  
 build-tools;24.0.2        | 24.0.2    | android sdk build-tools 24.0.2  
 build-tools;24.0.3        | 24.0.3    | android sdk build-tools 24.0.3  
 build-tools;25.0.0        | 25.0.0    | android sdk build-tools 25    
 build-tools;25.0.1        | 25.0.1    | android sdk build-tools 25.0.1  
 build-tools;25.0.2        | 25.0.2    | android sdk build-tools 25.0.2  
 build-tools;25.0.3        | 25.0.3    | android sdk build-tools 25.0.3  
 build-tools;26.0.0        | 26.0.0    | android sdk build-tools 26    
 cmake;3.6.4111459         | 3.6.4111459 | cmake 3.6.4111459        
 docs               | 1      | documentation for android sdk  
 emulator             | 26.1.2    | android emulator         
 extras;android;gapid;1      | 1.0.3    | gpu debugging tools       
 extras;android;gapid;3      | 3.1.0    | gpu debugging tools       
 extras;android;m2repository    | 47.0.0    | android support repository    
 extras;google;auto        | 1.1     | android auto desktop head unit...
 extras;google;g...e_play_services | 42      | google play services       
 extras;google;instantapps     | 1.0.0    | instant apps development sdk   
 extras;google;m2repository    | 55      | google repository        
 extras;google;m...t_apk_expansion | 1      | google play apk expansion library
 extras;google;market_licensing  | 1      | google play licensing library  
 extras;google;play_billing    | 5      | google play billing library   
 extras;google;simulators     | 1      | android auto api simulators   
 extras;google;webdriver      | 2      | google web driver        
 extras;m2reposi...ut-solver;1.0.0 | 1      | solver for constraintlayout 1.0.0
 extras;m2reposi...er;1.0.0-alpha2 | 1      | com.android.support.constraint...
 extras;m2reposi...er;1.0.0-alpha3 | 1      | com.android.support.constraint...
 extras;m2reposi...er;1.0.0-alpha4 | 1      | com.android.support.constraint...
 extras;m2reposi...er;1.0.0-alpha5 | 1      | solver for constraintlayout 1....
 extras;m2reposi...er;1.0.0-alpha6 | 1      | solver for constraintlayout 1....
 extras;m2reposi...er;1.0.0-alpha7 | 1      | solver for constraintlayout 1....
 extras;m2reposi...er;1.0.0-alpha8 | 1      | solver for constraintlayout 1....
 extras;m2reposi...er;1.0.0-alpha9 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ver;1.0.0-beta1 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ver;1.0.0-beta2 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ver;1.0.0-beta3 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ver;1.0.0-beta4 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ver;1.0.0-beta5 | 1      | solver for constraintlayout 1....
 extras;m2reposi...ut-solver;1.0.1 | 1      | solver for constraintlayout 1.0.1
 extras;m2reposi...ut-solver;1.0.2 | 1      | solver for constraintlayout 1.0.2
 extras;m2reposi...nt-layout;1.0.0 | 1      | constraintlayout for android 1...
 extras;m2reposi...ut;1.0.0-alpha2 | 1      | com.android.support.constraint...
 extras;m2reposi...ut;1.0.0-alpha3 | 1      | com.android.support.constraint...
 extras;m2reposi...ut;1.0.0-alpha4 | 1      | com.android.support.constraint...
 extras;m2reposi...ut;1.0.0-alpha5 | 1      | constraintlayout for android 1...
 extras;m2reposi...ut;1.0.0-alpha6 | 1      | constraintlayout for android 1...
 extras;m2reposi...ut;1.0.0-alpha7 | 1      | constraintlayout for android 1...
 extras;m2reposi...ut;1.0.0-alpha8 | 1      | constraintlayout for android 1...
 extras;m2reposi...ut;1.0.0-alpha9 | 1      | constraintlayout for android 1...
 extras;m2reposi...out;1.0.0-beta1 | 1      | constraintlayout for android 1...
 extras;m2reposi...out;1.0.0-beta2 | 1      | constraintlayout for android 1...
 extras;m2reposi...out;1.0.0-beta3 | 1      | constraintlayout for android 1...
 extras;m2reposi...out;1.0.0-beta4 | 1      | constraintlayout for android 1...
 extras;m2reposi...out;1.0.0-beta5 | 1      | constraintlayout for android 1...
 extras;m2reposi...nt-layout;1.0.1 | 1      | constraintlayout for android 1...
 extras;m2reposi...nt-layout;1.0.2 | 1      | constraintlayout for android 1...
 lldb;2.0             | 2.0.2558144 | lldb 2.0             
 lldb;2.1             | 2.1.2852477 | lldb 2.1             
 lldb;2.2             | 2.2.3271982 | lldb 2.2             
 lldb;2.3             | 2.3.3614996 | lldb 2.3             
 ndk-bundle            | 15.1.4119039 | ndk               
 patcher;v4            | 1      | sdk patch applier v4       
 platform-tools          | 26.0.0    | android sdk platform-tools    
 platforms;android-10       | 2      | android sdk platform 10     
 platforms;android-11       | 2      | android sdk platform 11     
 platforms;android-12       | 3      | android sdk platform 12     
 platforms;android-13       | 1      | android sdk platform 13     
 platforms;android-14       | 4      | android sdk platform 14     
 platforms;android-15       | 5      | android sdk platform 15     
 platforms;android-16       | 5      | android sdk platform 16     
 platforms;android-17       | 3      | android sdk platform 17     
 platforms;android-18       | 3      | android sdk platform 18     
 platforms;android-19       | 4      | android sdk platform 19     
 platforms;android-20       | 2      | android sdk platform 20     
 platforms;android-21       | 2      | android sdk platform 21     
 platforms;android-22       | 2      | android sdk platform 22     
 platforms;android-23       | 3      | android sdk platform 23     
 platforms;android-24       | 2      | android sdk platform 24     
 platforms;android-25       | 3      | android sdk platform 25     
 platforms;android-26       | 1      | android sdk platform 26     
 platforms;android-7        | 3      | android sdk platform 7      
 platforms;android-8        | 3      | android sdk platform 8      
 platforms;android-9        | 2      | android sdk platform 9      
 sources;android-15        | 2      | sources for android 15      
 sources;android-16        | 2      | sources for android 16      
 sources;android-17        | 1      | sources for android 17      
 sources;android-18        | 1      | sources for android 18      
 sources;android-19        | 2      | sources for android 19      
 sources;android-20        | 1      | sources for android 20      
 sources;android-21        | 1      | sources for android 21      
 sources;android-22        | 1      | sources for android 22      
 sources;android-23        | 1      | sources for android 23      
 sources;android-24        | 1      | sources for android 24      
 sources;android-25        | 1      | sources for android 25      
 system-images;a...ult;armeabi-v7a | 4      | arm eabi v7a system image    
 system-images;a...-10;default;x86 | 4      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 5      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 5      | google apis intel x86 atom sys...
 system-images;a...ult;armeabi-v7a | 2      | arm eabi v7a system image    
 system-images;a...ult;armeabi-v7a | 4      | arm eabi v7a system image    
 system-images;a...15;default;mips | 1      | mips system image        
 system-images;a...-15;default;x86 | 4      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 5      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 5      | google apis intel x86 atom sys...
 system-images;a...ult;armeabi-v7a | 4      | arm eabi v7a system image    
 system-images;a...16;default;mips | 1      | mips system image        
 system-images;a...-16;default;x86 | 5      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 5      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 5      | google apis intel x86 atom sys...
 system-images;a...ult;armeabi-v7a | 5      | arm eabi v7a system image    
 system-images;a...17;default;mips | 1      | mips system image        
 system-images;a...-17;default;x86 | 3      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 5      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 5      | google apis intel x86 atom sys...
 system-images;a...ult;armeabi-v7a | 4      | arm eabi v7a system image    
 system-images;a...-18;default;x86 | 3      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 5      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 5      | google apis intel x86 atom sys...
 system-images;a...ult;armeabi-v7a | 5      | arm eabi v7a system image    
 system-images;a...-19;default;x86 | 5      | intel x86 atom system image   
 system-images;a...pis;armeabi-v7a | 28      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 28      | google apis intel x86 atom sys...
 system-images;a...-tv;armeabi-v7a | 3      | android tv arm eabi v7a system...
 system-images;a...;android-tv;x86 | 3      | android tv intel x86 atom syst...
 system-images;a...ult;armeabi-v7a | 4      | arm eabi v7a system image    
 system-images;a...-21;default;x86 | 4      | intel x86 atom system image   
 system-images;a...;default;x86_64 | 4      | intel x86 atom_64 system image  
 system-images;a...pis;armeabi-v7a | 20      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 20      | google apis intel x86 atom sys...
 system-images;a...gle_apis;x86_64 | 20      | google apis intel x86 atom_64 ...
 system-images;a...-tv;armeabi-v7a | 1      | android tv arm eabi v7a system...
 system-images;a...;android-tv;x86 | 3      | android tv intel x86 atom syst...
 system-images;a...ult;armeabi-v7a | 2      | arm eabi v7a system image    
 system-images;a...-22;default;x86 | 5      | intel x86 atom system image   
 system-images;a...;default;x86_64 | 5      | intel x86 atom_64 system image  
 system-images;a...pis;armeabi-v7a | 14      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 14      | google apis intel x86 atom sys...
 system-images;a...gle_apis;x86_64 | 14      | google apis intel x86 atom_64 ...
 system-images;a...-tv;armeabi-v7a | 10      | android tv arm eabi v7a system...
 system-images;a...;android-tv;x86 | 10      | android tv intel x86 atom syst...
 system-images;a...ear;armeabi-v7a | 6      | android wear arm eabi v7a syst...
 system-images;a...ndroid-wear;x86 | 6      | android wear intel x86 atom sy...
 system-images;a...-23;default;x86 | 9      | intel x86 atom system image   
 system-images;a...;default;x86_64 | 9      | intel x86 atom_64 system image  
 system-images;a...pis;armeabi-v7a | 21      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 21      | google apis intel x86 atom sys...
 system-images;a...gle_apis;x86_64 | 21      | google apis intel x86 atom_64 ...
 system-images;a...;android-tv;x86 | 11      | android tv intel x86 atom syst...
 system-images;a...fault;arm64-v8a | 7      | arm 64 v8a system image     
 system-images;a...ult;armeabi-v7a | 7      | arm eabi v7a system image    
 system-images;a...-24;default;x86 | 7      | intel x86 atom system image   
 system-images;a...;default;x86_64 | 7      | intel x86 atom_64 system image  
 system-images;a..._apis;arm64-v8a | 14      | google apis arm 64 v8a system ...
 system-images;a...pis;armeabi-v7a | 14      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 14      | google apis intel x86 atom sys...
 system-images;a...gle_apis;x86_64 | 14      | google apis intel x86 atom_64 ...
 system-images;a...s_playstore;x86 | 13      | google play intel x86 atom sys...
 system-images;a...;android-tv;x86 | 5      | android tv intel x86 atom syst...
 system-images;a...ear;armeabi-v7a | 3      | android wear arm eabi v7a syst...
 system-images;a...ndroid-wear;x86 | 3      | android wear intel x86 atom sy...
 system-images;a..._apis;arm64-v8a | 6      | google apis arm 64 v8a system ...
 system-images;a...pis;armeabi-v7a | 6      | google apis arm eabi v7a syste...
 system-images;a...google_apis;x86 | 6      | google apis intel x86 atom sys...
 system-images;a...gle_apis;x86_64 | 6      | google apis intel x86 atom_64 ...
 system-images;a...;android-tv;x86 | 3      | android tv intel x86 atom syst...
 system-images;a...ndroid-wear;x86 | 1      | android wear intel x86 atom sy...
 system-images;a...google_apis;x86 | 4      | google apis intel x86 atom sys...
 system-images;a...s_playstore;x86 | 4      | google play intel x86 atom sys...
 tools               | 26.0.2    | android sdk tools        

available updates:
 id   | installed | available
 ------- | -------  | ------- 
 tools  | 26.0.1  | 26.0.2

0x04 安装需要的package

sdkmanager "build-tools;26.0.0"

根据需要安装,最后我安装的结果如下:

installed packages:
 path            | version | description          | location          
 -------           | ------- | -------            | -------           
 build-tools;25.0.3     | 25.0.3 | android sdk build-tools 25.0.3 | build-tools/25.0.3/     
 build-tools;26.0.0     | 26.0.0 | android sdk build-tools 26   | build-tools/26.0.0/     
 emulator          | 26.1.2 | android emulator        | emulator/          
 extras;android;m2repository | 47.0.0 | android support repository   | extras/android/m2repository/
 patcher;v4         | 1    | sdk patch applier v4      | patcher/v4/         
 platform-tools       | 26.0.0 | android sdk platform-tools   | platform-tools/       
 platforms;android-21    | 2    | android sdk platform 21    | platforms/android-21/    
 platforms;android-22    | 2    | android sdk platform 22    | platforms/android-22/    
 platforms;android-23    | 3    | android sdk platform 23    | platforms/android-23/    
 platforms;android-24    | 2    | android sdk platform 24    | platforms/android-24/    
 platforms;android-25    | 3    | android sdk platform 25    | platforms/android-25/    
 platforms;android-26    | 1    | android sdk platform 26    | platforms/android-26/    
 tools            | 26.0.2 | android sdk tools       | tools/

0x05 配置platform tools

打开 /etc/profile 添加如下命令:

cd /etc

//添加结果
...
export path user logname mail hostname histsize histcontrol
export path=$path:/opt/androidsdk/tools/bin
export path=$path:/opt/androidsdk/platform-tools
...

//然后执行更新生效
source profile

查看配置结果:

# adb version

android debug bridge version 1.0.39
revision 3db08f2c6889-android
installed as /opt/androidsdk/platform-tools/adb

从结果可以看出已经可以执行 adb 命令了.

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。