本文的思维导图(这里使用的是MindNode)
Android version history
Code Name | Version number | Release Date | API level | Features |
---|---|---|---|---|
Ice Cream Sandwich | 4.0 - 4.0.4 | October 2011 | 14 - 15 | 统一手机平板电视 / 虚拟按键 |
Jelly Bean | 4.1 - 4.3.1 | July 2012 | 16 - 18 | 增强通知栏 / UI优化 |
KitKat | 4.4 - 4.4.4 | October 2013 | 19 - 20 | 引入ART |
Lollipop | 5.0 - 5.1.1 | November 2014 | 21 - 22 | 强制ART / Material design |
Marshmallow | 6.0 - 6.0.1 | October 2015 | 23 | Android Pay / Fingerprint Support |
Nougat | 7.0 | August 2016 | 24 | 分屏多任务 / Java 8语言支持 |
What’s New in Android Studio 2.0
Instant Run: Faster Build & Deploy
- Flow chart of a typical build cycle
- The goals of Instant Run
Remove as many of these steps as possible, and make whatever remains as fast as possible
- Hot, Warm, and Cold Swaps
详细参考构建和运行您的应用
- App Server
当你在Android Studio点击Run按钮时, 首先会检测在你的App里是否有一个开启Socket端口的Server在运行, 来确定Instant Run是否可用
当你在开发过程中, Android Studio会监控哪些文件已经被改变, 运行一个自定义的Gradle Task为那些改变的class文件创建一个.dex文件
这个新的.dex文件会被Android Studio部署到我们运行的App Server里面, App Server接收到之后就会加载和部署被更新的classes, 使用之前注入到我们原始类, 委托方法来调用我们刚才加载覆盖的新classes里的方法
详细参考Instant Run原理解析
- Instant Run Tips and Tricks
(1) The availability of ART in Android 21 means you’ll get the most out of Instant Run by setting your minSdkVersion to 21 or higher
(2) Remember that changes to the manifest will trigger a full build and deploy cycle
Next-Generation Emulator
即使如此, Android Emulator仍然慢于Genymotion
What’s New in Android Studio 2.1
Support for Java 8 language features
首先下载并安装JDK1.8
然后配置build.gradle文件如下
android {
defaultConfig {
...
// 开启jack编译
jackOptions {
enabled true
}
}
...
// 将编译选项设置为Java1.8
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
What’s New in Android Studio 2.2
New UI Designer & Constraint Layout
详细参考官方教程
What’s New in Java8
lambda + Functional Programming
optional
CompletableFuture
Protocol Buffers
What are protocol buffers?
Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler
优点
性能好/效率高
代码生成机制, 维护成本低(.proto描述文件)
Objective-C和Swift的Protocol Buffers实现详见protobuf.io
对比
WebP
A new image format for the Web
WebP is a modern image format that provides superior lossless and lossy compression for images on the web
WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index
Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes
更多参考webp
优点
低失真/高压缩/支持透明度
浏览器和跨平台支持(SDWebImage对WebP的支持, 详细参考iOS开发 之 SDWebImage源码分析)
对比
对于下面的.png图片, 文件大小为38kb
使用WebP转换工具转换成.webp文件后, 文件大小只有8kb
注意: 这里的后缀名虽然为.png, 但是其实是webp文件, 因为简书不支持.webp后缀的图片
更多文章, 请支持我的个人博客