Android SDK簡介


鏈接:https://github.com/CaptainJi/Appium-AutoTest/blob/master/Appium%20MD%E6%95%99%E7%A8%8B/Android%E7%B3%BB%E7%BB%9F%E5%9F%BA%E7%A1%80/1.Android%20SDK.md

概念

SDK:(software development kit)軟件開發工具包。被軟件開發工程師用於為特定的軟件包、軟件框架、硬件平台、操作系統等建立應用軟件的開發工具的集合。 因此,Android SDK 指的是Android專屬的軟件開發工具包。

下載安裝

首先需要安裝配置好jdk環境。

Android SDK包下載

• 官網下載:https://android-sdk.en.softonic.com/download
• 網盤下載: http://tools.android-studio.org/index.php/sdk
下載對應的安裝包后,點擊安裝即可。

Android SDK Manager

安裝后啟動 SDK Manager.exe 程序就可以看到Android SDK Mannerger的主界面。

Tools目錄


Android SDK Tools(必須,只需下載一個版本,一般選最新版本):基礎工具包,版本號帶rc字樣的是預覽版。
Android SDK Platform-tools(必須,只需下載一個版本,一般選最新版本):從android2.3開始划出此目錄,存放公用開發工具,比如adb、sqlite3等,被划分到了這里。
Android SDK Build-tools(必須,可以安裝多個版本):Android項目構建工具。

Android xxx(API xx) 目錄(可選的各平台開發工具)


• Documentation for AndroidSdk(可選):安卓開發者官網的一些離線文檔,不過下載下來打開也很慢,后面會提供另外一個離線版。
• SDK Platform(必須):對應平台的開發工具,需要在哪個版本的平台下開發就下載哪個。
• Samples for SDK(可選,此項在高版本tools中已不提供,需要在IDE里通過Import Sample引入,當然也可以下載離線版):內置的安卓示例程序,推薦安裝。
• Sources for Android SDK(可選):安卓API的源代碼,推薦安裝。
• ARM /Intel xxxx Image(可選):各個以Image結尾的東西是支持相應平台的模擬器,我們就把它想象成一個刷機包吧。(使用真機調試或使用其它模擬器的話不需要安裝)

Extras目錄(可選的擴展)


• Android Support Repository(可選):主要是方便在gradle中使用Android Support Libraries,因為Google並沒有把這些庫發布到maven center或者jcenter去,而是使用了Google自己的maven倉庫。
• Intel x86 Emulator Accelerator(HAXM installer)(可選):windows平台的Intel x86模擬器加速工具,配合Intel x86 atom/atom_64 System Image使用可加快模擬器的運行速度。
• Tips:如果覺得一個個安裝下載太麻煩,可以直接在視頻下方【獲取素材】獲取已經下載打包好的Android_SDK壓縮包:Andriod_SDK.zip,立等可取,開箱即用!

Android SDK文件目錄

add-ons
這里面保存着附加庫,第三方公司為android 平台開發的附加功能系統。比如GoogleMaps,當然你如果安裝了OphoneSDK,這里也會有一些類庫在里面。
docs
這里面是Android SDKAPI參考文檔,所有的API都可以在這里查到。
extras
該文件夾下存放了Android support v4,v7,v13,v17包; 還有google提供額USB驅動、Intel提供的硬件加速等附加工具包, 和market_licensing作為AndroidMarket版權保護組件,一般發布付費應用到電子市場可以用它來反盜版。
platforms
是每個平台的SDK真正的文件,存放了不同版本的android系統。里面會根據APILevel划分的SDK版本。
samples
是Android SDK自帶的默認示例工程,里面的apidemos強烈推薦初學者運行學 習,對於SQLite數據庫操作可以查看NotePad這個例子,對於游戲開發Snake、LunarLander都是不錯的例子,對於Android主 題開發Home則是androidm5時代的主題設計原理。

環境變量設置

• 系統變量里面添加變量名 ANDROID_HOME 路徑為實際存放SDk的路徑 
• 其他幾個路徑配置到系統環境Path中如下圖所示:

配置檢測

在cmd界面輸入“adb” 和"appt"來判斷安裝是否成功。
adb命令

C:\Users\CaptainJi>adb<br>
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as E:\Andriod_sdk\platform-tools\adb.exe

global options:
 -a         listen on all network interfaces, not just localhost
 -d         use USB device (error if multiple devices connected)
 -e         use TCP/IP device (error if multiple TCP/IP devices available)
 -s SERIAL
     use device with given serial number (overrides $ANDROID_SERIAL)
 -p PRODUCT
     name or path ('angler'/'out/target/product/angler');
     default $ANDROID_PRODUCT_OUT
 -H         name of adb server host [default=localhost]
 -P         port of adb server [default=5037]
 -L SOCKET  listen on given socket for adb server [default=tcp:localhost:5037]<br>

aapt命令

C:\Users\CaptainJi>aapt
Android Asset Packaging Tool

Usage:
 aapt l[ist] [-v] [-a] file.{zip,jar,apk}
   List contents of Zip-compatible archive.

 aapt d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]
   strings          Print the contents of the resource table string pool in the APK.
   badging          Print the label and icon for the app declared in APK.
   permissions      Print the permissions from the APK.
   resources        Print the resource table from the APK.
   configurations   Print the configurations in the APK.
   xmltree          Print the compiled xmls in the given assets.
   xmlstrings       Print the strings of the given compiled xml assets.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM