Android Jetpack Weekly #9

Review of most interesting changes in Android Jetpack releases for the last week

Kirill Rozov
3 min readOct 12, 2019

A full list of changes can be found here.

First Jetpack Compose artifacts

The first portion of Jetpack Compose artifacts arrived:

  • androidx.compose:compose-compiler:0.1.0-dev01
  • androidx.compose:compose-runtime:0.1.0-dev01

They aren’t stable and have issues but I saw confirmation of usage Jetpack Compose in Android Studio 3.5 and 3.6. Together with androidx.compose artifacts arrived many artifacts in the groupandroidx.ui. Waiting for Android Dev Summit 2019 to hear more details.

New features in stables and alphas

Room 2.2.0 (changes since 2.1.0)

  • Pre-packaged Database: New APIs in RoomDatabase.Builder are now available for creating a RoomDatabase given an already populated database file from an asset of file.
  • Schema Default Values: @ColumnInfo now has a new property defaultValue that can be used to specify the default value of a column. Be careful about migration because default values are part of a database schema and will be validated during migrations.
  • Support for Many-to-Many Relations: @Relation now has a new property associateBy, that takes in a new annotation @Junction, used to declare a relation that needs to be satisfied via a junction table
  • One-to-One Relations: The restriction in POJO fields annotated with @Relation to be of type List or Set has been lifted, effectively allowing single-value relations to be represented
  • Specify target entity in DAO: The DAO annotations @Insert, @Update and @Delete now has a new property targetEntity, that allows specifying the target table the DAO method is meant to act on.
  • Coroutines Flow Support: @Query DAO methods can now be of return type Flow<T>. The returned Flow will re-emit a new set of values if the observing tables in the query are invalidated.
  • Gradle Incremental Annotation Processor: Room is now a Gradle isolating annotation processor and incrementability can be enabled via the processor option room.incremental. See Room Compiler Options for more information.
  • Expanding Projections: A new experimental compiler option room.expandProjection was added that causes Room to rewrite a query with a star projection to only contain the columns in the returning type POJO. For example, for a DAO method with @Query("SELECT * FROM Song") that returns a POJO named SongIdAndTitle with only two fields. Then Room will rewrite the query to SELECT id, title FROM Song such that the minimum set of columns to satisfy the return type are fetched.

Concurrent Futures 1.0.0

androidx.concurrent:concurrent-futures:1.0.0 provides CallbackToFutureAdapterclass, a minimalistic utility that allows to wrap callback-based code and return instances of ListenableFuture.

It is useful for libraries that would like to expose asynchronous operations in their java APIs in a more elegant way than custom callbacks, but don’t do enough multithreading heavy-lifting to take a dependency on full guava or RxJava due to library size concerns.

Transition 1.2.0 (changes since 1.1.0)

Support of Android 10 (API Level 29) was added. Migrated from new public APIs instead of using reflection.

Media2 1.0.1

Important bug fixes

Loader 1.1.0 (changes since 1.0.0)

Default Executor for AsyncTaskLoader was changed to AsyncTask.THREAD_POOL_EXECUTOR and you can override AsyncTaskLoader.getExecutor() to set custom Executor

WorkManager 2.3.0-alpha02

  • Support for long-running or important work that should be kept alive by the OS
  • APIs changes
  • Bug fixes

New Betas

New RCs

If you now Russian and want to know more about Android development you can subscribe to Android Broadcast Telegram Channel

--

--

Kirill Rozov
Kirill Rozov

No responses yet