PC パソコン

How to Fix “JdkImageTransform failure with JDK 26” in Android Studio

When Android Studio runs Gradle on JDK 26, a build can fail inside JdkImageTransform while resolving androidJdkImage or invoking jlink. Google tracks this as Issue #486844145 and lists “JdkImageTransform failure with JDK 26” among the issues fixed in Android Gradle Plugin (AGP) 9.2.0. This guide explains how to recover without confusing the JDK that runs Gradle with the Java toolchain used to compile source code.

Representative error log

Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar
     to match attributes {artifactType=_internal_android_jdk_image, ...}.
      > Execution failed for JdkImageTransform:
        .../platforms/android-XX/core-for-system-modules.jar.
         > Error while executing process .../bin/jlink

The task name, SDK path, and attribute details vary by project. The useful signature is that Gradle runs on JDK 26 and the log mentions JdkImageTransform, androidJdkImage, or jlink.

Cause

This is not normally caused by the application’s Java or Kotlin source. It is a compatibility defect between JDK 26 and the AGP transform that creates a build-time JDK image from Android SDK module artifacts. Google’s AGP 9.2.0 release notes list Issue #486844145 as fixed.

Important: The public release notes do not identify the first AGP version that introduced the defect, so it would be inaccurate to claim that every older release is affected. AGP 9.2.0 is the first fixed version explicitly confirmed by the official source.

Conditions and affected versions

  • Android Studio or CI runs the Gradle daemon on JDK 26.
  • The build resolves the androidJdkImage configuration and invokes JdkImageTransform.
  • The project uses an AGP version that does not include the fix for Issue #486844145.

AGP 9.2’s official compatibility table specifies Gradle 9.4.1 and JDK 17 as its minimum and default requirements. A JDK 26-specific fix does not mean that JDK 26 became AGP 9.2’s default runtime.

Recommended fix

  1. First, switch the Gradle JVM back to JDK 17. In Android Studio, open Settings (Preferences on macOS), then “Build, Execution, Deployment” → “Build Tools” → “Gradle,” and select a JDK 17 installation for Gradle JDK. Set CI’s JAVA_HOME to JDK 17 as well.
  2. Verify the JVM that actually runs Gradle.
    ./gradlew --version

    Confirm that the JVM line reports version 17.

  3. Upgrade to AGP 9.2.0 or later when the project permits it. If you choose AGP 9.2, update the Gradle Wrapper to 9.4.1 and validate plugin and dependency compatibility against the official table.
  4. Stop existing daemons and rebuild.
    ./gradlew --stop
    ./gradlew clean
    ./gradlew assembleDebug

Alternatives

If an AGP upgrade is not immediately possible, pinning the Gradle runtime to JDK 17 is the practical workaround. A Java toolchain can select a compiler or language level without changing the JVM that hosts the Gradle daemon. Check Android Studio’s Gradle JDK, JAVA_HOME, and the CI runner configuration independently.

Do not delete JDK jmods, replace SDK JARs, or patch jlink manually. Those approaches make the environment unsupported and difficult to reproduce.

How to verify the fix

  • ./gradlew --version reports the intended JVM.
  • Both Debug and Release builds complete locally and in CI.
  • The build log no longer contains failures involving JdkImageTransform, androidJdkImage, or jlink.
  • If you upgraded to AGP 9.2, the wrapper uses Gradle 9.4.1 or newer.

Cautions

sourceCompatibility, Kotlin’s jvmTarget, and Java toolchains control compilation and generated bytecode. The Gradle JVM runs Gradle and AGP themselves; that is the setting relevant to this failure. When upgrading AGP, review the release notes and compatibility table and test every build plugin used by the project.

Summary

The JDK 26 JdkImageTransform failure is a known AGP issue tracked by Google. Restore the officially supported JDK 17 Gradle runtime first, then upgrade to AGP 9.2.0 or later when feasible because that release contains the confirmed fix. Finally, verify the active JVM and run real Debug and Release builds both locally and in CI.

Official references