什么是AndroidX? [英] What is AndroidX?

查看:166
本文介绍了什么是AndroidX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关Android房间库的信息.我看到他们将包android更改为androidx.我不明白.有人可以解释吗?

I am reading about a room library of Android. I see they changed package android to androidx. I did not understand that. Can someone explain, please?

implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

即使android包也提供此功能.

implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"

  • 什么需要在androidx中而不是在androidx中打包新的支持库?
  • 现有项目中的用例和影响因素.
    • What was in need of packaging new support libraries in androidx instead of android?
    • Use case and affect factors in existing projects.
    • 推荐答案

      AndroidX-Android扩展库

      来自 AndroidX文档

      我们正在推出一种新的包装结构,以使其更清晰地显示 软件包与Android操作系统捆绑在一起,并且 与您的应用的APK打包在一起.展望未来,android.*包 层次结构将保留给随 操作系统.其他软件包将在新的androidx中发布.* 包层次结构作为AndroidX库的一部分.

      We are rolling out a new package structure to make it clearer which packages are bundled with the Android operating system, and which are packaged with your app's APK. Going forward, the android.* package hierarchy will be reserved for Android packages that ship with the operating system. Other packages will be issued in the new androidx.* package hierarchy as part of the AndroidX library.

      需要AndroidX

      AndroidX是经过重新设计的库,用于使程序包名称更清晰.因此,从现在开始, android 层次结构将仅适用于android操作系统附带的android默认类,而其他库/依赖项将成为 androidx 的一部分(更合理).因此,从现在开始,所有新开发都将在androidx中进行更新.

      Need of AndroidX

      AndroidX is a redesigned library to make package names more clear. So from now on android hierarchy will be for only android default classes, which comes with android operating system and other library/dependencies will be part of androidx (makes more sense). So from now on all the new development will be updated in androidx.

      com.android.support.**: androidx.
      com.android.support:appcompat-v7: androidx.appcompat:appcompat com.android.support:recyclerview-v7: androidx.recyclerview:recyclerview com.android.support:design: com.google.android.material:material

      com.android.support.** : androidx.
      com.android.support:appcompat-v7 : androidx.appcompat:appcompat com.android.support:recyclerview-v7 : androidx.recyclerview:recyclerview com.android.support:design : com.google.android.material:material

      为AndroidX软件包完成工件映射

      Complete Artifact mappings for AndroidX packages

      以前,support library使用的是SDK版本,而AndroidX使用 Semantic-version .它将从28.0.0→1.0.0转换为版本.

      Previously, support library used the SDK version but AndroidX uses the Semantic-version. It’s going to re-version from 28.0.0 → 1.0.0.

      在Android Studio 3.2(2018年9月)中,有直接选项可以将现有项目迁移到AndroidX.这将自动重构所有软件包.

      In Android Studio 3.2 (September 2018), there is a direct option to migrate existing project to AndroidX. This refactor all packages automatically.

      在迁移之前,强烈建议您备份项目.

      现有项目

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆