CentOS7安装Android SDK

2023-05-19 19:44:26 浏览数 (2)

# SDK版本下载

安装Android SDK时,可以提前到官网上查看可用下载的 SDK版本 (opens new window),版本信息如下截图

代码语言:javascript复制
[root@localhost androidSdk]# pwd
/usr/local/androidSdk
[root@localhost androidSdk]# wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
--2020-10-23 23:46:26--  https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
正在解析主机 dl.google.com (dl.google.com)... 203.208.43.97
正在连接 dl.google.com (dl.google.com)|203.208.43.97|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:87259900 (83M) [application/zip]
正在保存至: “commandlinetools-linux-6858069_latest.zip”

100%[=========================================================================================================================================================================>] 87,259,900  2.26MB/s 用时 32s    

2020-10-23 23:46:59 (2.60 MB/s) - 已保存 “commandlinetools-linux-6858069_latest.zip” [87259900/87259900])

[root@localhost androidSdk]# 
  • 配置全局环境 首先,出于好奇,我们应该先关心一下解压出了什么内容
代码语言:javascript复制
[root@localhost androidSdk]# pwd
/usr/local/androidSdk
[root@localhost androidSdk]# ls
commandlinetools-linux-6858069_latest.zip
[root@localhost androidSdk]# unzip commandlinetools-linux-6858069_latest.zip

......此处省略好多解压过程的信息

[root@localhost androidSdk]# ls
cmdline-tools commandlinetools-linux-6858069_latest.zip
[root@localhost androidSdk]# cd cmdline-tools/
[root@localhost cmdline-tools]# ls
bin  lib  NOTICE.txt  source.properties
[root@localhost cmdline-tools]# 

通过上述操作日志中可以看出,解压出来的commandlinetools-linux-6858069_latest.zip中就一个cmdline-tools(其实该cmdline-tools内容就是tools中的内容,即该目录下的bin包含sdkmanager工具),目录下包含了bin lib NOTICE.txt source.properties 其次,配置sdkmanager全局变量PATH

代码语言:javascript复制
export SDK_HOME=/usr/local/androidSdk
export PATH=${SDK_HOME}/cmdline-tools/bin:$PATH # 配置sdkmanager环境
# export PATH=${SDK_HOME}/tools/bin:$PATH # 配置通过cmdline-tools中的sdkmanager下载下来的tools中的sdkmanager

执行 source /etc/profile 重新加载配置文件后生效 最后,以上环境配置好之后,可以执行下面指令进行检查sdkmanager是否安装成功以及对应的版本信息

代码语言:javascript复制
[root@localhost ~]# sdkmanager --sdk_root=/usr/local/androidSdk/ --version
3.0

[root@localhost ~]# 

# sdkmanager的使用

  • sdkmanager官方文档 (opens new window)
  • 列出已安装和可用的软件包 sdkmanager --sdk_root=/usr/local/androidSdk/ --list
代码语言:javascript复制
[root@localhost androidSdk]# sdkmanager --sdk_root=/usr/local/androidSdk/ --list
[=======================================] 100% Computing updates...             
Available Packages:
  Path                                                                                     | Version      | Description                                                         
  -------                                                                                  | -------      | -------                                                             
  add-ons;addon-google_apis-google-15                                                      | 3            | Google APIs                                                         
  add-ons;addon-google_apis-google-16                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-17                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-18                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-19                                                      | 20           | Google APIs                                                         
  add-ons;addon-google_apis-google-21                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-22                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-23                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-24                                                      | 1            | Google APIs                                                         
  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                                          
  build-tools;26.0.1                                                                       | 26.0.1       | Android SDK Build-Tools 26.0.1                                      
  build-tools;26.0.2                                                                       | 26.0.2       | Android SDK Build-Tools 26.0.2                                      
  build-tools;26.0.3                                                                       | 26.0.3       | Android SDK Build-Tools 26.0.3                                      
  build-tools;27.0.0                                                                       | 27.0.0       | Android SDK Build-Tools 27                                          
  build-tools;27.0.1                                                                       | 27.0.1       | Android SDK Build-Tools 27.0.1                                      
  build-tools;27.0.2                                                                       | 27.0.2       | Android SDK Build-Tools 27.0.2                                      
  build-tools;27.0.3                                                                       | 27.0.3       | Android SDK Build-Tools 27.0.3                                      
  build-tools;28.0.0                                                                       | 28.0.0       | Android SDK Build-Tools 28                                          
  build-tools;28.0.1                                                                       | 28.0.1       | Android SDK Build-Tools 28.0.1                                      
  build-tools;28.0.2                                                                       | 28.0.2       | Android SDK Build-Tools 28.0.2                                      
  build-tools;28.0.3                                                                       | 28.0.3       | Android SDK Build-Tools 28.0.3                                      
  build-tools;29.0.0                                                                       | 29.0.0       | Android SDK Build-Tools 29                                          
  build-tools;29.0.1                                                                       | 29.0.1       | Android SDK Build-Tools 29.0.1                                      
  build-tools;29.0.2                                                                       | 29.0.2       | Android SDK Build-Tools 29.0.2                                      
  build-tools;29.0.3                                                                       | 29.0.3       | Android SDK Build-Tools 29.0.3                                      
  build-tools;30.0.0                                                                       | 30.0.0       | Android SDK Build-Tools 30                                          
  build-tools;30.0.1                                                                       | 30.0.1       | Android SDK Build-Tools 30.0.1                                      
  build-tools;30.0.2                                                                       | 30.0.2       | Android SDK Build-Tools 30.0.2                                      
  cmake;3.10.2.4988404                                                                     | 3.10.2       | CMake 3.10.2.4988404                                                
  cmake;3.6.4111459                                                                        | 3.6.4111459  | CMake 3.6.4111459                                                   
  cmdline-tools;1.0                                                                        | 1.0          | Android SDK Command-line Tools                                      
  cmdline-tools;2.1                                                                        | 2.1          | Android SDK Command-line Tools                                      
  cmdline-tools;3.0                                                                        | 3.0          | Android SDK Command-line Tools                                      
  cmdline-tools;latest                                                                     | 3.0          | Android SDK Command-line Tools (latest)                             
  emulator                                                                                 | 30.1.5       | Android Emulator                                                    
  extras;android;m2repository                                                              | 47.0.0       | Android Support Repository                                          
  extras;google;auto                                                                       | 1.1          | Android Auto Desktop Head Unit emulator                             
  extras;google;google_play_services                                                       | 49           | Google Play services                                                
  extras;google;instantapps                                                                | 1.9.0        | Google Play Instant Development SDK                                 
  extras;google;m2repository                                                               | 58           | Google Repository                                                   
  extras;google;market_apk_expansion                                                       | 1            | Google Play APK Expansion library                                   
  extras;google;market_licensing                                                           | 1            | Google Play Licensing Library                                       
  extras;google;simulators                                                                 | 1            | Android Auto API Simulators                                         
  extras;google;webdriver                                                                  | 2            | Google Web Driver                                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0        | 1            | Solver for ConstraintLayout 1.0.0                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4 | 1            | com.android.support.constraint:constraint-layout-solver:1.0.0-alpha4
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha8 | 1            | Solver for ConstraintLayout 1.0.0-alpha8                            
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1  | 1            | Solver for ConstraintLayout 1.0.0-beta1                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2  | 1            | Solver for ConstraintLayout 1.0.0-beta2                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3  | 1            | Solver for ConstraintLayout 1.0.0-beta3                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4  | 1            | Solver for ConstraintLayout 1.0.0-beta4                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5  | 1            | Solver for ConstraintLayout 1.0.0-beta5                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1        | 1            | Solver for ConstraintLayout 1.0.1                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2        | 1            | Solver for ConstraintLayout 1.0.2                                   
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0               | 1            | ConstraintLayout for Android 1.0.0                                  
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4        | 1            | com.android.support.constraint:constraint-layout:1.0.0-alpha4       
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8        | 1            | ConstraintLayout for Android 1.0.0-alpha8                           
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1         | 1            | ConstraintLayout for Android 1.0.0-beta1                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2         | 1            | ConstraintLayout for Android 1.0.0-beta2                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3         | 1            | ConstraintLayout for Android 1.0.0-beta3                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4         | 1            | ConstraintLayout for Android 1.0.0-beta4                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5         | 1            | ConstraintLayout for Android 1.0.0-beta5                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1               | 1            | ConstraintLayout for Android 1.0.1                                  
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2               | 1            | ConstraintLayout for Android 1.0.2                                  
  ndk-bundle                                                                               | 21.3.6528147 | NDK                                                                 
  ndk;16.1.4479499                                                                         | 16.1.4479499 | NDK (Side by side) 16.1.4479499                                     
  ndk;17.2.4988734                                                                         | 17.2.4988734 | NDK (Side by side) 17.2.4988734                                     
  ndk;18.1.5063045                                                                         | 18.1.5063045 | NDK (Side by side) 18.1.5063045                                     
  ndk;19.2.5345600                                                                         | 19.2.5345600 | NDK (Side by side) 19.2.5345600                                     
  ndk;20.0.5594570                                                                         | 20.0.5594570 | NDK (Side by side) 20.0.5594570                                     
  ndk;20.1.5948944                                                                         | 20.1.5948944 | NDK (Side by side) 20.1.5948944                                     
  ndk;21.0.6113669                                                                         | 21.0.6113669 | NDK (Side by side) 21.0.6113669                                     
  ndk;21.1.6352462                                                                         | 21.1.6352462 | NDK (Side by side) 21.1.6352462                                     
  ndk;21.2.6472646                                                                         | 21.2.6472646 | NDK (Side by side) 21.2.6472646                                     
  ndk;21.3.6528147                                                                         | 21.3.6528147 | NDK (Side by side) 21.3.6528147                                     
  patcher;v4                                                                               | 1            | SDK Patch Applier v4                                                
  platform-tools                                                                           | 30.0.4       | 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                                                                     | 2            | Android SDK Platform 26                                             
  platforms;android-27                                                                     | 3            | Android SDK Platform 27                                             
  platforms;android-28                                                                     | 6            | Android SDK Platform 28                                             
  platforms;android-29                                                                     | 5            | Android SDK Platform 29                                             
  platforms;android-30                                                                     | 3            | Android SDK Platform 30                                             
  platforms;android-7                                                                      | 3            | Android SDK Platform 7                                              
  platforms;android-8                                                                      | 3            | Android SDK Platform 8                                              
  platforms;android-9                                                                      | 2            | Android SDK Platform 9                                              
  skiaparser;1                                                                             | 4            | Layout Inspector image server for API 29-30                         
  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                                              
  sources;android-26                                                                       | 1            | Sources for Android 26                                              
  sources;android-27                                                                       | 1            | Sources for Android 27                                              
  sources;android-28                                                                       | 1            | Sources for Android 28                                              
  sources;android-29                                                                       | 1            | Sources for Android 29                                              
  sources;android-30                                                                       | 1            | Sources for Android 30                                              
  system-images;android-10;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-10;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-10;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-10;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-14;default;armeabi-v7a                                             | 2            | ARM EABI v7a System Image                                           
  system-images;android-15;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-15;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-15;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-15;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-16;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-16;default;mips                                                    | 1            | MIPS System Image                                                   
  system-images;android-16;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-16;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-16;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-17;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-17;default;mips                                                    | 1            | MIPS System Image                                                   
  system-images;android-17;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-17;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-17;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-18;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-18;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-18;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-18;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-19;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-19;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-19;google_apis;armeabi-v7a                                         | 40           | Google APIs ARM EABI v7a System Image                               
  system-images;android-19;google_apis;x86                                                 | 40           | Google APIs Intel x86 Atom System Image                             
  system-images;android-21;android-tv;armeabi-v7a                                          | 3            | Android TV ARM EABI v7a System Image                                
  system-images;android-21;android-tv;x86                                                  | 3            | Android TV Intel x86 Atom System Image                              
  system-images;android-21;default;armeabi-v7a                                             | 4            | ARM EABI v7a System Image                                           
  system-images;android-21;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-21;default;x86_64                                                  | 5            | Intel x86 Atom_64 System Image                                      
  system-images;android-21;google_apis;armeabi-v7a                                         | 32           | Google APIs ARM EABI v7a System Image                               
  system-images;android-21;google_apis;x86                                                 | 32           | Google APIs Intel x86 Atom System Image                             
  system-images;android-21;google_apis;x86_64                                              | 32           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-22;android-tv;x86                                                  | 3            | Android TV Intel x86 Atom System Image                              
  system-images;android-22;default;armeabi-v7a                                             | 2            | ARM EABI v7a System Image                                           
  system-images;android-22;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-22;default;x86_64                                                  | 6            | Intel x86 Atom_64 System Image                                      
  system-images;android-22;google_apis;armeabi-v7a                                         | 26           | Google APIs ARM EABI v7a System Image                               
  system-images;android-22;google_apis;x86                                                 | 26           | Google APIs Intel x86 Atom System Image                             
  system-images;android-22;google_apis;x86_64                                              | 26           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-23;android-tv;armeabi-v7a                                          | 12           | Android TV ARM EABI v7a System Image                                
  system-images;android-23;android-tv;x86                                                  | 21           | Android TV Intel x86 Atom System Image                              
  system-images;android-23;android-wear;armeabi-v7a                                        | 6            | Android Wear ARM EABI v7a System Image                              
  system-images;android-23;android-wear;x86                                                | 6            | Android Wear Intel x86 Atom System Image                            
  system-images;android-23;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-23;default;x86                                                     | 10           | Intel x86 Atom System Image                                         
  system-images;android-23;default;x86_64                                                  | 10           | Intel x86 Atom_64 System Image                                      
  system-images;android-23;google_apis;armeabi-v7a                                         | 33           | Google APIs ARM EABI v7a System Image                               
  system-images;android-23;google_apis;x86                                                 | 33           | Google APIs Intel x86 Atom System Image                             
  system-images;android-23;google_apis;x86_64                                              | 33           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-24;android-tv;x86                                                  | 22           | Android TV Intel x86 Atom System Image                              
  system-images;android-24;default;arm64-v8a                                               | 7            | ARM 64 v8a System Image                                             
  system-images;android-24;default;armeabi-v7a                                             | 7            | ARM EABI v7a System Image                                           
  system-images;android-24;default;x86                                                     | 8            | Intel x86 Atom System Image                                         
  system-images;android-24;default;x86_64                                                  | 8            | Intel x86 Atom_64 System Image                                      
  system-images;android-24;google_apis;arm64-v8a                                           | 27           | Google APIs ARM 64 v8a System Image                                 
  system-images;android-24;google_apis;x86                                                 | 27           | Google APIs Intel x86 Atom System Image                             
  system-images;android-24;google_apis;x86_64                                              | 27           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-24;google_apis_playstore;x86                                       | 19           | Google Play Intel x86 Atom System Image                             
  system-images;android-25;android-tv;x86                                                  | 16           | Android TV Intel x86 Atom System Image                              
  system-images;android-25;android-wear-cn;armeabi-v7a                                     | 4            | China version of Android Wear ARM EABI v7a System Image             
  system-images;android-25;android-wear-cn;x86                                             | 4            | China version of Android Wear Intel x86 Atom System Image           
  system-images;android-25;android-wear;armeabi-v7a                                        | 3            | Android Wear ARM EABI v7a System Image                              
  system-images;android-25;android-wear;x86                                                | 3            | Android Wear Intel x86 Atom System Image                            
  system-images;android-25;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-25;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-25;google_apis;arm64-v8a                                           | 18           | Google APIs ARM 64 v8a System Image                                 
  system-images;android-25;google_apis;armeabi-v7a                                         | 18           | Google APIs ARM EABI v7a System Image                               
  system-images;android-25;google_apis;x86                                                 | 18           | Google APIs Intel x86 Atom System Image                             
  system-images;android-25;google_apis;x86_64                                              | 18           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-25;google_apis_playstore;x86                                       | 9            | Google Play Intel x86 Atom System Image                             
  system-images;android-26;android-tv;x86                                                  | 14           | Android TV Intel x86 Atom System Image                              
  system-images;android-26;android-wear-cn;x86                                             | 4            | China version of Android Wear Intel x86 Atom System Image           
  system-images;android-26;android-wear;x86                                                | 4            | Android Wear Intel x86 Atom System Image                            
  system-images;android-26;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-26;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-26;google_apis;x86                                                 | 16           | Google APIs Intel x86 Atom System Image                             
  system-images;android-26;google_apis;x86_64                                              | 16           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-26;google_apis_playstore;x86                                       | 7            | Google Play Intel x86 Atom System Image                             
  system-images;android-27;android-tv;x86                                                  | 9            | Android TV Intel x86 Atom System Image                              
  system-images;android-27;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-27;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-27;google_apis;x86                                                 | 11           | Google APIs Intel x86 Atom System Image                             
  system-images;android-27;google_apis_playstore;x86                                       | 3            | Google Play Intel x86 Atom System Image                             
  system-images;android-28;android-tv;x86                                                  | 10           | Android TV Intel x86 Atom System Image                              
  system-images;android-28;android-wear-cn;x86                                             | 4            | China version of Wear OS Intel x86 Atom System Image                
  system-images;android-28;android-wear;x86                                                | 4            | Wear OS Intel x86 Atom System Image                                 
  system-images;android-28;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-28;default;x86_64                                                  | 4            | Intel x86 Atom_64 System Image                                      
  system-images;android-28;google_apis;x86_64                                              | 11           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-28;google_apis_playstore;x86                                       | 9            | Google Play Intel x86 Atom System Image                             
  system-images;android-28;google_apis_playstore;x86_64                                    | 8            | Google Play Intel x86 Atom_64 System Image                          
  system-images;android-28;google_ndk;x86                                                  | 10           | Google X86_ARM Intel x86 Atom System Image                          
  system-images;android-29;android-tv;x86                                                  | 3            | Android TV Intel x86 Atom System Image                              
  system-images;android-29;default;x86                                                     | 7            | Intel x86 Atom System Image                                         
  system-images;android-29;default;x86_64                                                  | 7            | Intel x86 Atom_64 System Image                                      
  system-images;android-29;google_apis;x86                                                 | 11           | Google APIs Intel x86 Atom System Image                             
  system-images;android-29;google_apis;x86_64                                              | 11           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-29;google_apis_playstore;x86                                       | 8            | Google Play Intel x86 Atom System Image                             
  system-images;android-29;google_apis_playstore;x86_64                                    | 8            | Google Play Intel x86 Atom_64 System Image                          
  system-images;android-30;google_apis;x86                                                 | 9            | Google APIs Intel x86 Atom System Image                             
  system-images;android-30;google_apis;x86_64                                              | 9            | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-30;google_apis_playstore;x86                                       | 9            | Google Play Intel x86 Atom System Image                             
  system-images;android-30;google_apis_playstore;x86_64                                    | 9            | Google Play Intel x86 Atom_64 System Image                          

[root@localhost androidSdk]# 

选择安装软件包 platform-tools build-tools;30.0.2 platforms;android-30 安装的cmd指令:sdkmanager --sdk_root=/usr/local/androidSdk/ "platform-tools" "platforms;android-30" "build-tools;30.0.2"(这三个安装包可以分开安装,这边是偷懒的写法,即一次性安装了三个) 在关心下 下载上述三个软件包之后的内容

代码语言:javascript复制
[root@localhost androidSdk]# pwd
/usr/local/androidSdk
[root@localhost androidSdk]# ls -l
总用量 4
drwxr-xr-x. 3 root root   20 10月 24 00:09 build-tools
drwxr-xr-x. 4 root root   71 10月 23 23:48 cmdline-tools
drwxr-xr-x. 7 root root 4096 10月 24 00:08 emulator
drwxr-xr-x. 2 root root   33 10月 24 00:03 licenses
drwxr-xr-x. 3 root root   16 10月 24 00:06 patcher
drwxr-xr-x. 3 root root   24 10月 24 00:03 platforms
drwxr-xr-x. 5 root root  288 10月 24 00:03 platform-tools
drwxr-xr-x. 6 root root  205 10月 24 00:09 tools
[root@localhost androidSdk]# 

下载了platform-tools之后,我们就可以把adb也一块配置上去了,即在 source /etc/profile中追加以下全局配置

代码语言:javascript复制
export PATH=${SDK_HOME}/platform-tools:$PATH # 配置adb环境

记得 source /etc/profile 并检查是否下载成功以及配置是否生效

代码语言:javascript复制
[root@localhost ~]# adb --version
Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
Installed as /usr/local/androidSdk/platform-tools/adb
[root@localhost ~]#

至此,androidSdk即安装完成! 所有配置内容如下

代码语言:javascript复制
export SDK_HOME=/usr/local/androidSdk
# 配置通过cmdline-tools中的sdkmanager下载下来的tools中的sdkmanager
# export PATH=${SDK_HOME}/tools/bin:$PATH
# 配置sdkmanager环境
export PATH=${SDK_HOME}/cmdline-tools/bin:$PATH
# 配置adb环境
export PATH=${SDK_HOME}/platform-tools:$PATH

参考环境变量

代码语言:javascript复制
#sdk
#export ANDROID_HOME=/usr/local/android-sdk-linux
#export PATH=$ANDROID_HOME/tools:$PATH
#export PATH=$ANDROID_HOME/platforms:$PATH
export SDK_HOME=/usr/local/androidSdk
export PATH=${SDK_HOME}/cmdline-tools/bin:$PATH
#export PATH=${SDK_HOME}/platform-tools/:$PATH
#export PATH=${SDK_HOME}/tools/:$PATH
export PATH=${SDK_HOME}/tools/bin:$PATH
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn
##
export GRADLE_HOME=/data/gradle-7.3.3
export export PATH=${GRADLE_HOME}/bin:${PATH}

其它问题

报错如下

解决方法:

在android目录下的gradle.properties添加android.jetifier.blacklist=bcprov-jdk15on

0 人点赞