Documentation

​
​

Development

User Acquisition

Monetization

Industry

LevelPlay SDK - Android

Unity SDK

Android SDK

iOS SDK

Adobe AIR SDK

Flutter SDK

React Native SDK

LevelPlay SDK - Android

Unity LevelPlay
​
​
Android SDK
  • Get started
  • Regulations and settings
  • Ad formats
  • Mediated networks
  • Test your integration
    • LevelPlay integration test suite
    • Integration Helper for Android
    • Test your integration
    • Integration checklists
    • Troubleshoot no ads displaying
    • Troubleshoot the TCF consent log
    • Troubleshoot Android build failures caused by Kotlin 2
    • Test Ad Quality SDK integration
  1. Grow your game
  2. Unity LevelPlay
  3. LevelPlay SDK
  4. LevelPlay SDK for Android developers

Troubleshoot Android build failures caused by Kotlin 2

Identify and fix Android build failures caused by the Kotlin 2 dependency introduced in LevelPlay 9.6.0 when building a native Android app whose Kotlin version is lower than 2.0.0.
Read time 3 minutes
Last updated a month ago

If you use the Kotlin version lower than 2.0.0, you might encounter Android build failures. This guide explains how to identify and resolve them.

Symptom

After you upgrade the LevelPlay SDK dependency to 9.6.0, your Android build fails during Kotlin compilation. The Build Output panel in Android Studio shows the failing task as
:app:compile<Variant>Kotlin
(for example,
:app:compileDebugKotlin
), and the Gradle log contains an excerpt similar to:
> Task :app:compileDebugKotlin FAILED e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors e: file:///.../transformed/jetified-kotlin-stdlib-2.1.21.jar!/META-INF/kotlin-stdlib.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.8.0. e: file:///.../src/main/java/.../<YourFile>.kt:NN:NN Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The actual metadata version is 2.1.0, but the compiler version 1.8.0 can read versions up to 1.9.0.
To confirm before applying the fix, you can inspect the resolved Kotlin stdlib version:
./gradlew :app:dependencies | grep kotlin-stdlib
If you see
kotlin-stdlib:2.x.x
in the graph while your project's Kotlin Gradle Plugin is on 1.x, this guide applies to you.

Causes

Android build failures are likely to occur for the following reasons:
  • The LevelPlay SDK 9.6.0 (and some of its network adapters) has a dependency on the Kotlin 2.x standard library (currently
    kotlin-stdlib-2.1.21
    ).
  • A Kotlin version defined for the project lower than 2.0 will be incompatible with LevelPlay SDK 9.6.0 that uses Kotlin 2.x.

Resolution

To resolve this issue, upgrade the Kotlin Gradle Plugin (KGP) version your project uses to 2.0.0 or higher. The recommended target is 2.1.21, which is the version LevelPlay 9.6.0 itselfships, so your project's stdlib matches the SDK's.

Upgrade requirements

Upgrading to Kotlin 2.0 or higher might require updating or configuring related toolchain versions, as follows:
  • JDK 17 is required to run the Kotlin 2.0 or higher compiler. To set JDK 17 in Android Studio, in your project, go to Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK.
  • KSP, if used, is tied to the Kotlin version. Upgrade
    com.google.devtools.ksp
    to a release that matches your Kotlin version.
  • Jetpack Compose, if used, requires the Compose Compiler Gradle plugin starting with Kotlin 2.0. The legacy
    composeOptions.kotlinCompilerExtensionVersion
    setting no longer applies.
  • Upgrading Kotlin might also display deprecation warnings or
    source-incompatible
    changes in your own code under the K2 compiler. Refer to the Kotlin 2.0.0 What's new release notes for additional information.

Verify the resolution

  1. In Android Studio, run File > Sync Project with Gradle Files, Build > Rebuild Project.
  2. Confirm the build is fixed by checking: a. The Gradle output ends with a
    BUILD SUCCESSFUL
    message and
    :app:compile<Variant>Kotlin
    completes without errors. b. The Incompatible classes that were found in dependencies message no longer appear in the build log.
If the error persists, try the following:
  • Confirm the kotlin dependencies in the
    build.gradle
    use the updated kotlin version.
  • Clear the Gradle cache by running
    ./gradlew --stop
    followed by
    rm -rf ~/.gradle/caches/transforms-3/
    , then rebuild. Alternatively, in Android Studio, use File > Invalidate Caches…, then rebuild.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Symptom

    • Causes

    • Resolution

      • Upgrade requirements

    • Verify the resolution


Report a problem with this page