Concurrent
  
Move tasks off the main thread with coroutines and take advantage of ListenableFuture.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
June 12, 2024 1.2.0 - - -

Declaring dependencies

To add a dependency on Futures, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    implementation "androidx.concurrent:concurrent-futures:1.2.0"

    // Kotlin
    implementation "androidx.concurrent:concurrent-futures-ktx:1.2.0"
}

Kotlin

dependencies {
    implementation("androidx.concurrent:concurrent-futures:1.2.0")

    // Kotlin
    implementation("androidx.concurrent:concurrent-futures-ktx:1.2.0")
}

For more information about dependencies, see Add Build Dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.2

Version 1.2.0

June 12, 2024

androidx.concurrent:concurrent-futures:1.2.0 and androidx.concurrent:concurrent-futures-ktx:1.2.0 are released. Version 1.2.0 contains these commits.

Important changes since 1.1.0

Version 1.2.0-rc01

May 29, 2024

androidx.concurrent:concurrent-futures:1.2.0-rc01 and androidx.concurrent:concurrent-futures-ktx:1.2.0-rc01 are released. Version 1.2.0-rc01 contains these commits.

Version 1.2.0-beta01

May 14, 2024

androidx.concurrent:concurrent-futures:1.2.0-beta01 and androidx.concurrent:concurrent-futures-ktx:1.2.0-beta01 are released. Version 1.2.0-beta01 contains these commits.

Version 1.2.0-alpha03

March 20, 2024

androidx.concurrent:concurrent-futures:1.2.0-alpha03 and androidx.concurrent:concurrent-futures-ktx:1.2.0-alpha03 are released. Version 1.2.0-alpha03 contains these commits.

Bug Fixes

  • Fixed a bug in error handling when a SuspendToFutureAdapter task throws an exception. (b/327629504)

Version 1.2.0-alpha02

August 9, 2023

androidx.concurrent:concurrent-futures:1.2.0-alpha02 and androidx.concurrent:concurrent-futures-ktx:1.2.0-alpha02 are released. Version 1.2.0-alpha02 contains these commits.

API Changes

  • Added SuspendToFutureAdapter for writing suspend-ListenableFuture bridges (Ia8a66)

Version 1.2.0-alpha01

February 22, 2023

androidx.concurrent:concurrent-futures:1.2.0-alpha01 and androidx.concurrent:concurrent-futures-ktx:1.2.0-alpha01 are released. Version 1.2.0-alpha01 contains these commits.

API Changes

  • ResolvableFuture now has proper nullability annotations on its methods. (I2339f, b/236474470)

Version 1.1.0

Version 1.1.0

August 19, 2020

androidx.concurrent:concurrent-futures:1.1.0 and androidx.concurrent:concurrent-futures-ktx:1.1.0 are released with no changes since 1.1.0-rc01. Version 1.1.0 contains these commits.

Major changes since 1.0.0

  • 1.1.0 introduces Kotlin extensions to help convert between ListenableFuture and Kotlin Coroutines, now available with androidx.concurrent:concurrent-futures-ktx:1.1.0. This artifact is meant to be used with com.google.guava:listenablefuture as opposed to the full Guava library, which is a lightweight substitute for Guava that only contains ListenableFuture. For users of the full Guava library, you should use the official ListenableFuture extensions from kotlinx.coroutines.kotlinx-coroutines-guava instead.

Version 1.1.0-rc01

July 22, 2020

androidx.concurrent:concurrent-futures:1.1.0-rc01 and androidx.concurrent:concurrent-futures-ktx:1.1.0-rc01 are released with no changes since 1.1.0-beta01. Version 1.1.0-rc01 contains these commits.

Version 1.1.0-beta01

June 24, 2020

androidx.concurrent:concurrent-futures:1.1.0-beta01 and androidx.concurrent:concurrent-futures-ktx:1.1.0-beta01 are released with no changes since 1.1.0-alpha01. Version 1.1.0-beta01 contains these commits.

Version 1.1.0-alpha01

December 18, 2019

androidx.concurrent:concurrent-futures:1.1.0-alpha01 and androidx.concurrent:concurrent-futures-ktx:1.1.0-alpha01 are released. Version 1.1.0-alpha01 contains these commits. This is first release of androidx.concurrent:concurrent-futures-ktx.

New features

  • Kotlin extensions to help convert between ListenableFuture and Kotlin Coroutines are now available in concurrent-futures-ktx. This artifact is meant to be used with com.google.guava:listenablefuture as opposed to the full Guava library, which is a lightweight substitute for Guava that only contains ListenableFuture. For users of the full Guava library, you should use the official ListenableFuture extensions from kotlinx.coroutines.kotlinx-coroutines-guava instead.

API changes

  • Adds a suspending ListenableFuture.await() extension which converts a ListenableFuture to a Kotlin Coroutine

Version 1.0.0

Version 1.0.0

October 9, 2019

androidx.concurrent:concurrent-futures:1.0.0 is released. Version 1.0.0 contains these commits.

Important features of 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 rx java due to library size concerns.

Version 1.0.0-rc01

August 7, 2019

androidx.concurrent:concurrent-futures:1.0.0-rc01 is released with no changes from 1.0.0-beta01. The commits included in this version can be found here.

Concurrent-ListenableFuture Version 1.0.0-beta01

May 30th, 2019

androidx.concurrent:concurrent-listenablefuture:1.0.0-beta01 and androidx.concurrent:concurrent-listenablefuture-callback:1.0.0-beta01 are released. The commits included in this version can be found here.

These libraries provide a standalone equivalent to Guava’s ListenableFuture interface and an adapter for converting callbacks.

The previously-released androidx.concurrent:concurrent-futures artifact, which provided a similar adapter and included the com.google.guava:listenablefuture artifact, may be problematic for developers using toolchains -- such as Android Gradle Plugin 3.4.0 -- with strict dependency resolution matching. Developers who do not rely on the full Guava library are advised to switch to androidx.concurrent:concurrent-listenablefuture-callback.

Version 1.0.0-beta01

May 7, 2019

androidx.concurrent:concurrent-futures:1.0.0-beta01 is released. The commits included in this version can be found here.

API changes

  • ResolvableFuture and AbstractResolvableFuture were hidden from public api in favor CallbackToFutureAdapter that provides safer API.

Version 1.0.0-alpha03

December 17, 2018

androidx.concurrent:concurrent-futures 1.0.0-alpha03 is released.

New features

  • CallbackToFutureAdapter was introduced. It’s a new, safer API to wrap a callback driven API into ListenableFuture. Prefer it over using ResolvableFuture.