本文的思維導(dǎo)圖(這里使用的是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 | 統(tǒng)一手機平板電視 / 虛擬按鍵 |
Jelly Bean | 4.1 - 4.3.1 | July 2012 | 16 - 18 | 增強通知欄 / UI優(yōu)化 |
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 | 分屏多任務(wù) / 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
當(dāng)你在Android Studio點擊Run按鈕時, 首先會檢測在你的App里是否有一個開啟Socket端口的Server在運行, 來確定Instant Run是否可用
當(dāng)你在開發(fā)過程中, Android Studio會監(jiān)控哪些文件已經(jīng)被改變, 運行一個自定義的Gradle Task為那些改變的class文件創(chuàng)建一個.dex文件
這個新的.dex文件會被Android Studio部署到我們運行的App Server里面, App Server接收到之后就會加載和部署被更新的classes, 使用之前注入到我們原始類, 委托方法來調(diào)用我們剛才加載覆蓋的新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
}
}
...
// 將編譯選項設(shè)置為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
優(yōu)點
性能好/效率高
代碼生成機制, 維護成本低(.proto描述文件)
Objective-C和Swift的Protocol Buffers實現(xiàn)詳見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
優(yōu)點
低失真/高壓縮/支持透明度
瀏覽器和跨平臺支持(SDWebImage對WebP的支持, 詳細參考iOS開發(fā) 之 SDWebImage源碼分析)
對比
對于下面的.png圖片, 文件大小為38kb
使用WebP轉(zhuǎn)換工具轉(zhuǎn)換成.webp文件后, 文件大小只有8kb
注意: 這里的后綴名雖然為.png, 但是其實是webp文件, 因為簡書不支持.webp后綴的圖片
更多文章, 請支持我的個人博客