What’s new in Android support Library

Android support libraries is crucial in development because it provide backward compatibility and it also provide additional convenience classes and features not available in the standard Framework API for easier development and support across more devices.

Finer grained artifacts-

  • Feature based maven groupid and artifactid
  • Scoped to individual widgets
  • Compatible with old artifacts
  • Binary compatible

We can now include only libraries we are going to use feature wise.

Package Name refactoring-

Package Name refactoring

How to migrate to new Android X-

For migrating libraries in your app a new tab is available inside Refractor tab in Android studio(≥3.2) will be available so don’t worry!.
For migration of binary dependencies a new tool Jetifier is released which will perform refactoring task inside jar/aar file.(Jetifier is available as standalone jar or gradle plugin).

Note- Stable release of android studio 3.2 will take some time so till then support library version 28.0.0 will be available but after this all release will be in android x package.

New Feature releases-

  1. Recycler view selection -
  • Touch and mouse driven.
  • Item selection area.
  • Item rejection.
  • preserve state between activity lifecycle events.
  • Fine grained control(can be included only when needed)

How to use-

Use Recycler view selection

2.RecyclerView ListAdapter-

  • Operate on immutable lists
  • Simplified ways to use DiffUtil
  • Provide animated updates
  • Concurrency support

3.AndroidX webkit(for API 21+ device only)-

  • Provide access to latest Webview platform APIs.
  • Relies on updatable webview apk.

4. Browser library -

  • android.support.customtabs library refactored to androidx.browser.
  • Browser actions are added allows app to hook into browser context click menu.(Works in chrome version >66).

5. HeifWriter- High efficiency image format(a newer image format). It will take byte buffers, surface and bitmaps and write them to file.currently available only for API 28+(No backward compatible).

6.Slices- It allows app content to display outside your app like in google search.

Example -We can add slices to book cab directly from search whenever user search lyft (or uber) along with app link your favorite destination will appear along with time and price just by one tap you will land to book cab screen.

Slices API usecase

How to use-

We have to register slice sample in Android manifest inside provider tag.
To know more about slices and how to use see this.

7. Material Components-
Instead of support design library now material components will be available in com.google.android.material package.

What all widgets changed you can understand quickly from below picture

Material components changes

That’s all about support library changes in brief for detailed discussion watch this.

You can also check following posts from Google I/O 2018.