【目录】

1. Architecture Components 之 Guide to App Architecture

2. Architecture Components 之 Adding Components to your Project

3. Architecture Components 之 Handling Lifecycles

4. Architecture Components 之 LiveData

5. Architecture Components 之 ViewModel

6. Architecture Components 之 Room Persistence Library

示例代码链接

添加组件到项目中

警告:Architecture Components 还是 alpha 版本,在 1.0 版本发布之前可能有重大更改。

Architecture Components 可以从 Google 的 Maven 仓库获取。要使用它们,请按照下列步骤操作:

添加 Google Maven 仓库

默认情况下 Android Studio 没有配置访问此库。

要将该库添加到项目中,请打开项目中的 build.gradle 文件(不是应用或模块下的)并且添加如下所示的高亮的行。

allprojects {    repositories {        jcenter()        maven { url 'https://maven.google.com' }    }}

添加 Architecture Components

打开应用或模块中的 build.gradle 文件并将所需的组件添加为依赖:

  • 使用 Lifecycles,LiveData 和 ViewModel 需要添加:

    • compile "android.arch.lifecycle:runtime:1.0.0-alpha1"

    • compile "android.arch.lifecycle:extensions:1.0.0-alpha1"

    • annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"

  • 使用 Room 需要添加:

    • compile "android.arch.persistence.room:runtime:1.0.0-alpha1"

    • annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"

    • 使用测试 Room 迁移需要添加:

      • testCompile "android.arch.persistence.room:testing:1.0.0-alpha1"
    • 使用 Room 的 RxJava 支持需要添加:

      • compile "android.arch.persistence.room:rxjava2:1.0.0-alpha1"

有关更多信息,请参阅添加构建依赖。

[译] Architecture Components 之 Adding Components to your Project相关推荐

  1. [译] Architecture Components 之 Room Persistence Library

    [目录] 1. Architecture Components 之 Guide to App Architecture 2. Architecture Components 之 Adding Comp ...

  2. [译] MDC-101 Flutter:Material Components(MDC)基础(Flutter)

    原文地址:MDC-101 Flutter: Material Components (MDC) Basics (Flutter) 原文作者:codelabs.developers.google.com ...

  3. 译——项目管理铁三角(The Iron Triangle of project management)

    When I used to work as a project management consultant, I would hear brilliant leaders around me say ...

  4. Web Components 简述

    要说最近几年来,前端开发最火的一个趋势或最火的前端开发框架是什么,第一想到的是,组件及推崇组件化开发的React框架.本文将介绍Web Components规范并就组件的几大特性进行讨论. 前言 在开 ...

  5. UIColor and components

    UIColor是iOS小伙伴们经常运用的一个类,也是Apple提供的一个很好用的颜色设置的类.今天要说到的是通过UIColor如何正确取得color components对应的R.G.B,及alpha ...

  6. 【Vue Laravel-mix】Error with Vue lazy loading components: “Failed to resolve async component“

    [Vue Laravel-mix] 报错信息: Error with Vue lazy loading components: "Failed to resolve async compon ...

  7. Web Components 上手指南

    现在的前端开发基本离不开 React.Vue 这两个框架的支撑,而这两个框架下面又衍生出了许多的自定义组件库: Element(Vue) Ant Design(React) 这些组件库的出现,让我们可 ...

  8. 我如何使用React,Redux-Saga和Styled Components构建NBA球员资料获取器

    by Jonathan Puc 乔纳森·普克(Jonathan Puc) 我如何使用React,Redux-Saga和Styled Components构建NBA球员资料获取器 (How I buil ...

  9. 关于报错Unknown custom element:did you register the component correctly? For recursive components的解决方式

    报错: [Vue warn]: Unknown custom element: <d01-person-thing> - did you register the component co ...

最新文章

  1. linux成长笔录——week_1
  2. open***在Windows客户端权限那些事
  3. Win7删除休眠文件
  4. 作者:Gopakumar Gopalakrishnan,男,印度科技大学管理学博士,印孚瑟斯技术有限公司高级研究科学家。...
  5. BufferedInputStream的read()方法源码解析
  6. r mysql utf8_R读取MySQL数据出现乱码,解决该问题的方法总结
  7. vue 读取ajax数据,详解vue 中使用 AJAX获取数据的方法
  8. FIT2CLOUD飞致云完成C轮和C+轮融资,持续引领中国多云管理市场
  9. AI人机对战五子棋游戏【Python(pygame)+AI】并实现软件输出
  10. 电子负载使用恒电流和恒电阻负载模式的方法
  11. 创意爆破效果PS动作
  12. C#-钉钉开发H5应用-事件订阅
  13. 算法问题——(树问题集合)
  14. Excel常用函数(案例说明)
  15. C# 国际化问题之CultureInfo(小数点的不同一些欧洲国家习惯使用,而非.)
  16. 在数据库中,视图有什么用?什么时候需要用到视图?
  17. WPF——【关键字:WPF】TextBox输入框提示文字
  18. ArcGIS教程:ArcGIS中的图表是什么
  19. java 探花交友项目day5 推荐好友列表 MongoDB集群 发布动态,查询动态 圈子功能
  20. 爱企查 爬取公司基本信息

热门文章

  1. 关于安装完Node.js 出现node is not dedined 问题
  2. js获取DIV的位置坐标的三种方法!
  3. 关于 asp.net 服务器控件几个 ID 的说明
  4. 大数据之-Hadoop3.x_MapReduce_序列化案例Debug调试---大数据之hadoop3.x工作笔记0101
  5. Sharding-Sphere,Sharding-JDBC_分库分表(水平分库_水平分表)_Sharding-Sphere,Sharding-JDBC分布式_分库分表工作笔记004
  6. ubuntu下使用vi是方向键变乱码 退格键不能使用的解决方法
  7. EJB3.0异常总结---Exception in thread “main“ javax.naming.NameNotFoundException: StatelessEjbBean not bou
  8. caffe 使用cudnn 加速报错
  9. maven从私服下载jar包不成功的问题
  10. 机器学习与计算机视觉(sklearn快速上手)