分享

Android实战技巧之二十二:Android 5.1 SDK下载与配置

 昵称30349853 2016-01-23

重要文件下载地址:

(1)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
(3)http://dl-ssl.google.com/android/repository/android-22_r01.zip
(4)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
(6)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
(8)http://dl-ssl.google.com/android/repository/docs-22_r01.zip
(9)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
(11)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

按照惯例,linux版本的只需将上述地址中的windows换成linux即可。

SDK目录结构

:/opt/sdk$ ls
add-ons  build-tools  docs extras  platforms  platform-tools  samples  sources  system-images  temp  tmp  tools
  • 1
  • 2

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
  • 1
  • 2

3.samples
例子是学习的第三个途径。将其放入samples目录下即可,如下:

$ ls samples/
android-10  android-15  android-16  android-17  android-18  android-19  android-5.1
  • 1
  • 2

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
  • 1
  • 2

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.+'
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

演示如下图:




参考:
http://www.cnblogs.com/warnier-zhang/p/4369647.html
http://www.cnblogs.com/yaotong/archive/2011/01/25/1943615.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多