android开发 之 新技术(精华版)

本文的思维导图(这里使用的是MindNode)

android-new-techs_01.png

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语言支持

更多参考Android version history

What’s New in Android Studio 2.0

Instant Run: Faster Build & Deploy

  • Flow chart of a typical build cycle
android-new-techs_01.png
  • 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
android-new-techs_02.png
android-new-techs_03.png

详细参考构建和运行您的应用

  • 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

详细参考Instant Run: How Does it Work?!

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
    }
}

更多参考30分钟入门Java8之lambda表达式

What’s New in Android Studio 2.2

New UI Designer & Constraint Layout

详细参考官方教程

What’s New in Java8

lambda + Functional Programming

optional

详细参考可选类型Optional对比-java8,guava,kotlin,swift

CompletableFuture

详细参考Package java.util.concurrent

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

优点

对比

对于下面的.png图片, 文件大小为38kb

android-new-techs_01.png

使用WebP转换工具转换成.webp文件后, 文件大小只有8kb

android-new-techs_01.png

注意: 这里的后缀名虽然为.png, 但是其实是webp文件, 因为简书不支持.webp后缀的图片

更多文章, 请支持我的个人博客

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容