Skip to content

build: Pin the Gradle daemon to JDK 21 - #6364

Draft
runningcode wants to merge 2 commits into
mainfrom
no/gradle-daemon-jvm-21
Draft

runningcode wants to merge 2 commits into
mainfrom
no/gradle-daemon-jvm-21

Conversation

@runningcode

@runningcode runningcode commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

  • Add gradle/gradle-daemon-jvm.properties with toolchainVersion=21. Gradle then starts the daemon on an installed JDK 21, whatever JAVA_HOME points to.
  • Remove the JDK version check from build.gradle.kts, and update CONTRIBUTING.md to match.
  • Replace -XX:+CrashOnOutOfMemoryError with -XX:+HeapDumpOnOutOfMemoryError in the daemon JVM args. A daemon that runs out of memory now writes a heap dump to analyze instead of crashing.
  • Set org.gradle.welcome=never to skip Gradle's welcome message.
  • Set android.disableAgpUpgradePrompt=true to stop Android Studio prompting to upgrade AGP.

💡 Motivation and Context

Since #6242 the build requires JDK 21. If JAVA_HOME points to an older JDK, it fails with "This build requires JDK 21 or newer". With the daemon JVM pinned, ./gradlew works without switching JAVA_HOME first.

toolchainVersion=21 only accepts JDK 21, not newer ones, so the check in build.gradle.kts can no longer fail. CONTRIBUTING.md said a newer JDK runs the build, which is no longer true.

Without a JDK 21 installed, Gradle now fails before configuring the build with "Unable to download toolchain matching the requirements ({languageVersion=21, ...})". This isn't a new requirement: compilation already uses a JDK 21 toolchain, and the build doesn't configure any toolchain downloads.

💚 How did you test it?

Ran ./gradlew spotlessApply apiDump with JAVA_HOME set to JDK 17. The daemon started on JDK 21 and the build passed.

In throwaway projects:

  • A file asking for JDK 17 failed even though JDK 21 and 25 were installed, so the version has to match exactly.
  • With an empty Gradle home and only JDK 17 visible, a file asking for JDK 21 failed with the error above.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

None.

#skip-changelog

🤖 Generated with Claude Code

Since #6242 the build needs JDK 21 to run Gradle. Daemon JVM criteria
let Gradle pick an installed JDK 21 regardless of JAVA_HOME.

Also write a heap dump on daemon OOM instead of crashing, and silence
Gradle's welcome message and Android Studio's AGP upgrade prompt.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sentry

sentry Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.61.1 (1) release

⚙️ sentry-android Build Distribution Settings

The daemon JVM criteria only accept JDK 21, so the check can't fail.
CONTRIBUTING.md no longer claims a newer JDK runs the build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@romtsn romtsn left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set org.gradle.welcome=never to skip Gradle's welcome message.

but I want to be welcomed by Gradle, Nelson 😿

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants