ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 重要文件下载地址: (1)[http://dl-ssl.google.com/android/repository/sources-22_r01.zip](http://dl-ssl.google.com/android/repository/sources-22_r01.zip)  (2)[http://dl-ssl.google.com/android/repository/tools_r24.1.2-windows.zip](http://dl-ssl.google.com/android/repository/tools_r24.1.2-windows.zip)  (3)[http://dl-ssl.google.com/android/repository/android-22_r01.zip](http://dl-ssl.google.com/android/repository/android-22_r01.zip)  (4)[http://dl-ssl.google.com/android/repository/samples-22_r05.zip](http://dl-ssl.google.com/android/repository/samples-22_r05.zip)  (5)[http://dl-ssl.google.com/android/repository/build-tools_r21.1.2-windows.zip](http://dl-ssl.google.com/android/repository/build-tools_r21.1.2-windows.zip)  (6)[http://dl-ssl.google.com/android/repository/build-tools_r22-windows.zip](http://dl-ssl.google.com/android/repository/build-tools_r22-windows.zip)  (7)[http://dl-ssl.google.com/android/repository/build-tools_r22.0.1-windows.zip](http://dl-ssl.google.com/android/repository/build-tools_r22.0.1-windows.zip)  (8)[http://dl-ssl.google.com/android/repository/docs-22_r01.zip](http://dl-ssl.google.com/android/repository/docs-22_r01.zip)  (9)[http://dl-ssl.google.com/android/repository/sysimg_x86-22_r01.zip](http://dl-ssl.google.com/android/repository/sysimg_x86-22_r01.zip)  (10)[http://dl-ssl.google.com/android/repository/sysimg_x86_64-22_r01.zip](http://dl-ssl.google.com/android/repository/sysimg_x86_64-22_r01.zip)  (11)[http://dl-ssl.google.com/android/repository/sysimg_arm-22_r01.zip](http://dl-ssl.google.com/android/repository/sysimg_arm-22_r01.zip)  (12)[http://dl-ssl.google.com/android/repository/haxm-windows_r05.3.zip](http://dl-ssl.google.com/android/repository/haxm-windows_r05.3.zip) 按照惯例,linux版本的只需将上述地址中的windows换成linux即可。 ## SDK目录结构 ~~~ :/opt/sdk$ ls add-ons build-tools docs extras platforms platform-tools samples sources system-images temp tmp tools ~~~ **1.docs**  只需将原来的docs目录重命名,如docs-21,将最新的docs-22解压即可。文档是学习Android新feature的重要途径,一定要重视。  **2.sources**  API源码,另一个重要的学习资料。将其解压到sources目录下,最好将其api号标好,比如我这里: ~~~ $ ls sources/ android-14 android-15 android-16 android-17 android-18 android-19 android-21 android-22 ~~~ **3.samples**  例子是学习的第三个途径。将其放入samples目录下即可,如下: ~~~ $ ls samples/ android-10 android-15 android-16 android-17 android-18 android-19 android-5.1 ~~~ **4.platform**  这是sdk中的核心。将sources-22_r01.zip解压到platforms目录,如下: ~~~ $ ls platforms/ android-10 android-14 android-15 android-16 android-17 android-18 android-19 android-21 android-5.1 android-L ~~~ **5.编译工具**  tools_r24.1.2、build-tools_r22.0.1分别放到tools和build-tools下。  **6.sysimg**  有了5.1的platform我们就可以开发5.1的应用了,但是我们还缺少一个模拟器。这是sysimg要做的事情。  将sysimg_arm-22_r01.zip解压到platform-tools目录下。 ## 第一个Android5.1例子 build.gradle如下: ~~~ apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.linc.testapi22" minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.+' } ~~~ 演示如下图:  ![](https://box.kancloud.cn/2016-01-01_5685d198068eb.jpg)  ![](https://box.kancloud.cn/2016-01-01_5685d1981cb2c.jpg)  ![](https://box.kancloud.cn/2016-01-01_5685d19833f50.jpg)  ![](https://box.kancloud.cn/2016-01-01_5685d1985154f.jpg)  ![](https://box.kancloud.cn/2016-01-01_5685d1986e553.jpg) 参考:  [http://www.cnblogs.com/warnier-zhang/p/4369647.html](http://www.cnblogs.com/warnier-zhang/p/4369647.html)  [http://www.cnblogs.com/yaotong/archive/2011/01/25/1943615.html](http://www.cnblogs.com/yaotong/archive/2011/01/25/1943615.html)