Java Desugaring

Some libraries (e.g. Google Play Services) may require core library desugaring to support certain Java 8+ APIs. If your build fails with an error indicating that desugaring is required, please follow the instructions below to enable it.

1. Add compileOptions

Locate and open the file at android/app/build.gradle .

Then, inside the android block, add the compileOptions section:

android {
    compileOptions {
        coreLibraryDesugaringEnabled true
    }
}

2. Add Desugaring dependency

Inside the dependencies block of the same android/app/build.gradle file, add:

dependencies {
  coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}

Please check Maven Central for the latest version of desugar_jdk_libs.

3. Build the project

Now you can build your project. Desugaring will be applied during the Gradle build.

Last updated