What is AndroidX?

后端 未结 10 1056
死守一世寂寞
死守一世寂寞 2020-11-22 03:38

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, pleas

10条回答
  •  别那么骄傲
    2020-11-22 04:33

    Just some bits addition from my side to all available answers

    Need of AndroidX

    1. As said in amazing answer by @KhemRaj,

    With the current naming convention, it isn’t clear which packages are bundled with the Android operating system, and which are packaged with your application’s APK (Android Package Kit). To clear up this confusion, all the unbundled libraries will be moved to AndroidX’s androidx.* namespace, while the android.* package hierarchy will be reserved for packages that ship with the Android operating system.

    1. Other than this,

      Initially, the name of each package indicated the minimum API level supported by that package, for example support-v4. However, version 26.0.0 of the Support Library increased the minimum API to 14, so today many of the package names have nothing to do with the minimum supported API level. When support-v4 and the support-v7 packages both have a minimum API of 14, it’s easy to see why people get confused!. So now with AndroidX, there is no dependence on the API level.

    Another important change is that the AndroidX artifacts will update independently, so you’ll be able to update individual AndroidX libraries in your project, rather than having to change every dependency at once. Those frustrating “All com.android.support libraries must use the exact same version specification” messages should become a thing of the past!

提交回复
热议问题