linux下配置android sdk
該文章介紹下如何在linux中配置android sdk
一、下載android sdk
下載SDK,下載地址:https://developer.android.com/sdk/index.html,選擇Linux(i386)。因為SDK隻有32位的,如果裝的是64位係統,則要安裝ia32-libs,運行32位程序。安裝命令:sudo apt-get install ia32-libs(在Ubuntu中的命令)。下載完成後解壓,在終端進入到SDK的根目錄,然後執行:tools/android update sdk –no-ui即可開始和windows裏麵一樣的更新。
[root@app-server1 tools]# android update sdk --no-ui
Refresh Sources:
Fetching https://dl-ssl.google.com/android/repository/addons_list-1.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Refresh Sources
Fetching URL: https://dl-ssl.google.com/android/repository/repository-6.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-6.xml
Parse XML: https://dl-ssl.google.com/android/repository/repository-6.xml
Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
Parse XML: https://dl-ssl.google.com/android/repository/addon.xml
Fetching URL: https://dl.htcdev.com/sdk/addon.xml
Validate XML: https://dl.htcdev.com/sdk/addon.xml
Parse XML: https://dl.htcdev.com/sdk/addon.xml
Fetching URL: https://software.intel.com/sites/landingpage/android/addon.xml
Validate XML: https://software.intel.com/sites/landingpage/android/addon.xml
Parse XML: https://software.intel.com/sites/landingpage/android/addon.xml
Fetching URL: https://www.echobykyocera.com/download/echo_repository.xml
Validate XML: https://www.echobykyocera.com/download/echo_repository.xml
Parse XML: https://www.echobykyocera.com/download/echo_repository.xml
Fetching URL: https://developer.lgmobile.com/sdk/android/repository.xml
Validate XML: https://developer.lgmobile.com/sdk/android/repository.xml
Parse XML: https://developer.lgmobile.com/sdk/android/repository.xml
Fetching URL: https://android-sdk-addons.motodevupdate.com/addons.xml
Validate XML: https://android-sdk-addons.motodevupdate.com/addons.xml
Parse XML: https://android-sdk-addons.motodevupdate.com/addons.xml
Fetching URL: https://innovator.samsungmobile.com/android/repository/repository.xml
Validate XML: https://innovator.samsungmobile.com/android/repository/repository.xml
Parse XML: https://innovator.samsungmobile.com/android/repository/repository.xml
Fetching URL: https://developer.sonymobile.com/edk/android/repository.xml
Validate XML: https://developer.sonymobile.com/edk/android/repository.xml
Parse XML: https://developer.sonymobile.com/edk/android/repository.xml
Installing Archives:
Preparing to install archives
Downloading Android SDK Platform-tools, revision 11
Installing Android SDK Platform-tools, revision 11
Stopping ADB server failed (code -1).
Installed Android SDK Platform-tools, revision 1199%)
Downloading Documentation for Android SDK, API 15, revision 2
Installing Documentation for Android SDK, API 15, revision 2
Installed Documentation for Android SDK, API 15, revision 297%)
Downloading SDK Platform Android 4.0.3, API 15, revision 3
Installing SDK Platform Android 4.0.3, API 15, revision 3
Installed SDK Platform Android 4.0.3, API 15, revision 396%)
Downloading SDK Platform Android 4.0, API 14, revision 3
Installing SDK Platform Android 4.0, API 14, revision 3
Installed SDK Platform Android 4.0, API 14, revision 396%)
Downloading SDK Platform Android 3.2, API 13, revision 1
Installing SDK Platform Android 3.2, API 13, revision 1
Installed SDK Platform Android 3.2, API 13, revision 198%)
Downloading SDK Platform Android 3.1, API 12, revision 3
Installing SDK Platform Android 3.1, API 12, revision 3
Installed SDK Platform Android 3.1, API 12, revision 398%)
Downloading SDK Platform Android 3.0, API 11, revision 2
Installing SDK Platform Android 3.0, API 11, revision 2
Installed SDK Platform Android 3.0, API 11, revision 298%)
Downloading SDK Platform Android 2.3.3, API 10, revision 2
Installing SDK Platform Android 2.3.3, API 10, revision 2
Installed SDK Platform Android 2.3.3, API 10, revision 298%)
Downloading SDK Platform Android 2.2, API 8, revision 3
Installing SDK Platform Android 2.2, API 8, revision 3
Installed SDK Platform Android 2.2, API 8, revision 399%)
Downloading SDK Platform Android 2.1, API 7, revision 3
Installing SDK Platform Android 2.1, API 7, revision 3
Installed SDK Platform Android 2.1, API 7, revision 399%)
Downloading SDK Platform Android 1.6, API 4, revision 3
Installing SDK Platform Android 1.6, API 4, revision 3
Installed SDK Platform Android 1.6, API 4, revision 399%)
Downloading SDK Platform Android 1.5, API 3, revision 4
Installing SDK Platform Android 1.5, API 3, revision 4
Installed SDK Platform Android 1.5, API 3, revision 499%)
Downloading Samples for SDK API 15, revision 2
Installing Samples for SDK API 15, revision 2
Installed Samples for SDK API 15, revision 296%)
Downloading Samples for SDK API 14, revision 2
Installing Samples for SDK API 14, revision 2
Installed Samples for SDK API 14, revision 296%)
Downloading Samples for SDK API 13, revision 1
Installing Samples for SDK API 13, revision 1
Installed Samples for SDK API 13, revision 195%)
Downloading Samples for SDK API 12, revision 1
Installing Samples for SDK API 12, revision 1
Installed Samples for SDK API 12, revision 195%)
Downloading Samples for SDK API 11, revision 1
Installing Samples for SDK API 11, revision 1
Installed Samples for SDK API 11, revision 195%)
Downloading Samples for SDK API 10, revision 1
Installing Samples for SDK API 10, revision 1
Installed Samples for SDK API 10, revision 195%)
Downloading Samples for SDK API 8, revision 1
Installing Samples for SDK API 8, revision 1
Installed Samples for SDK API 8, revision 196%)
Downloading Samples for SDK API 7, revision 1
Installing Samples for SDK API 7, revision 1
Installed Samples for SDK API 7, revision 196%)
Downloading Android Support, revision 8
Installing Android Support, revision 8
Installed Android Support, revision 891%)
Downloading Google AdMob Ads SDK, revision 6
Installing Google AdMob Ads SDK, revision 6
Installed Google AdMob Ads SDK, revision 694%)
Downloading Google Analytics SDK, revision 2
Installing Google Analytics SDK, revision 2
Installed Google Analytics SDK, revision 292%)
Downloading Google Play APK Expansion Library, revision 1
Installing Google Play APK Expansion Library, revision 1
Installed Google Play APK Expansion Library, revision 178%)
Downloading Google Play Billing Library, revision 2
Installing Google Play Billing Library, revision 2
Installed Google Play Billing Library, revision 284%)
Downloading Google Play Licensing Library, revision 2
Installing Google Play Licensing Library, revision 2
Installed Google Play Licensing Library, revision 272%)
Downloading Google Web Driver, revision 2
Installing Google Web Driver, revision 2
Installed Google Web Driver, revision 299%)
Downloading Android SDK Tools, revision 19
Installing Android SDK Tools, revision 19
Installed Android SDK Tools, revision 1999%)
Downloading ARM EABI v7a System Image, Android API 15, revision 2
Installing ARM EABI v7a System Image, Android API 15, revision 2
Installed ARM EABI v7a System Image, Android API 15, revision 299%)
Downloading Intel x86 Atom System Image, Android API 15, revision 1
………(下麵省略)………
上麵更新的過程中一些特殊的SDK是需要用戶名和密碼的,如:摩托羅拉和HTC。
我們到這些官網注冊一下即可,摩托羅拉和HTC的網址:
注冊官網:https://htcdev.com/ 這個是HTC的;具體的注冊過程我就不多說了,要是看不懂的大家直接在線翻譯一下就可以了
另外一個:https://developer.motorola.com/ 這個是MOTO的,也是一樣的需要注冊一下,方法同上麵的HTC的一樣
二、配置環境變量
更新完成後配置環境變量。使用命令 vi /etc/profile 編輯文件profile,然後在下麵增加下麵內容:
export ANDROID_HOME=/opt/softwaretools/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
/opt/softwaretools/android-sdk-linux為SDK的根目錄。
這個配置之後,以後要執行android裏麵的命令,就不是需要進到這個目錄,直接可以在終端裏麵輸入。
修改完成後,使用命令 :wq! 保存關閉文件,再執行命令 source /etc/profile 使配置生效一下。
在終端輸入:android,如果Android SDK Manager窗口出來了,就證明環境配置成功。
------------------------------------------------------------------------------------------------------------------------------------------
參考資料:https://blog.csdn.net/maylian7700/article/details/7538176
最後更新:2017-04-02 17:09:28