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. Make sure to enable Custom Launcher Gradle Template in Unity
In Unity:
Go to
Edit>Project Settings>PlayerSelect the Android tab
Under Publishing Settings, check Custom Launcher Gradle Template
This will generate editable Gradle file in your Unity project:
Assets/Plugins/Android/launcherTemplate.gradle
2. Modify launcherTemplate.gradle
Open Assets/Plugins/Android/launcherTemplate.gradle. Inside the android block, add:
android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}Inside the dependencies block, add:
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.3'
}Please check Maven Central for the latest version of desugar_jdk_libs.
3. Build the Project
Now you can build your project directly from Unity. Desugaring will be applied during the Gradle build.
Last updated