Google I/O 2021 Android精华内容
程序员文章站
2022-06-15 14:06:07
Google I/O 2021结束了, 都有什么精彩内容呢? Android部分的Playlist附上: Android & Play at Google I/O 2021 Developer Keynote (Google I/O '21) 对于Android的部分来说, 主要是: Android ......
google i/o 2021结束了, 都有什么精彩内容呢?
android部分的playlist附上: android & play at google i/o 2021
developer keynote (google i/o '21)
对于android的部分来说, 主要是:
android 12
- user safety.
- performance; improved app startup; customizable launch animations.
- user experience; widgets.
create beautiful apps, easier
现代化的android开发.
- android studio的升级.
- kotlin: kotlin symbol processing.
- jetpack: 各种libraries和compose.
build across screens.
- 各种屏幕.
- voice.
- watches: health services.
the top 3 things to know in modern android development | android @ google i/o'21
android开发的三个top topic:
- jetpack: 一系列的jetpack libraries发布了新版.
- tooling: android studio的升级, 有了workmanager inspector, ui的inspector支持了view和compose.
- kotlin.
what's new in android | keynote
android 12 -> s
.
-
@deprecated
-> deprecated. - color.
- widgets.
- launch animations: 系统自带启动动画, 可以定制.
- notifications: 新的template style;
trampoline
(?) 优化点开notification的那个短暂延迟. - toasts: 带icon, 说明是哪个app弹的toasts; 控制个数.
- picture in picture的改善.
- imageview有个setrendereffect可以模糊照片了.
- 可以用theme定制模糊.
- list的弹力拉伸效果. (我自己起的名字, 其实人家叫stretch overscroll).
- graphics: avif. 可以过滤支持的media类型.
- privacy: 关于permission的一些改进; 剪贴板内容会有toast说明来源; foreground restrictions.
what’s new in android development tools | session
android studio版本号设计.
- preview工具可以设置横屏, 定制尺寸, 显示blueprints, play animation. compose的preview有交互模式.
- accessibility test framework scanner.
- 适配多种屏幕: layout validation.
- 折叠屏, 手表.
- 模拟器还可以模拟heart rate.
- snapshots test.
- workmanager的tasks.
- migrate to non-transitive r classes...
what’s new in jetpack | session
解释了jetpack的初衷和现状.
alpha和beta版本的意思.
- experimental annotations -> stable.
- camerax -> stable.
- appsearch -> alpha.
- datastore -> 用来取代sharedpreferences.
- security crypto -> stable.
- hilt -> stable.
- workmanager -> stable. (android studio也推出了新的workmanager inspector.)
- room -> stable.
- constraintlayout -> stable. motionlayout + motion editor.
- fragment -> stable.
(详见release notes:
重建了fragmentmanager; 新增了get result的callback; 废弃了一些api, 并且fragment strictmode
可以检测项目中是否还在使用. - navigation -> alpha. 现在支持多个backstacks.
- google shortcuts -> alpha.
- emojicompat -> alpha. (appcompat 1.4.0以后默认包含.)
- paging -> stable.
- macrobenchmark -> alpha. (app启动和滚动效率; local/ci.)
- compose integrations.
what's new in jetpack compose | session
为什么我们需要一个全新的ui toolkit呢. -> 为了适应更加现代化的开发方式.
faster & easier.
compose将数据转换成ui.
checkbox的例子:
ui完全由参数控制. -> single source of truth. 没有其他的状态需要sync.
把参数和回调提到方法参数中去:
- you completely describe your ui for a given state.
- the framework updates your ui when the state changes.
这里有个图, 推荐viewmodel暴露一个screen状态, 集中管理, 然后下发到每个composable.
这样也利于测试.
compose实现了material design, 提供了组件, 还有theming system.
有一个owl app的实现解说.
和传统view的interop.
state of kotlin on android | session
- kotlin变得越来越流行, 不仅app, 还有server.
- kotlin symbol processing目前发布了alpha.
- 编译器的升级.
- 好多好多的ktx库.
- protobuf的支持:
- coroutines的debugger -> coming soon. 可以在线程之间跳转, 查看信息.
what’s new in android gradle plugin | session
new apis in the android gradle plugin
using jetpack libraries in compose | session
jetpack compose和jetpack中其他库可以很好的结合使用.
top 12 tips to get ready for android 12 | session
getting ready for android 12.
- developer options -> app compatibility changes.
- foreground services were designed for multi-tasking and completing a user action. -> 从后台启动foreground services将被限制.
- expedited jobs with workmanager apis.
- user may turn off the mic and camera sensors using mic and camera toggles.
- apps that have not been used for an extended period will be hibernated. (permissions, storage, services)
- nearby device permission. decouple bluetooth scanning from location.
- mac address restriction.
- safe component exporting. 有intent filter就必须显式声明exported.
- custom notifications deprecation.
- app link improvements.
- webview samesite.
- new stretch overscroll.