Repository navigation
fix(cli): Keep the Android wizard going when ./gradlew fails - #2805
Merged
Merged
Conversation
The Android wizard stopped with abort() whenever ./gradlew failed after adding the Sentry Gradle plugin, leaving build.gradle edited but no manifest or test snippet, and blaming the Sentry plugin. The build often fails for reasons outside the plugin: a shell JDK older than AGP 9 needs, no network, or a project that was already broken. @sentry/wizard 9.1.0 warned and continued. Warn with the end of Gradle's stderr and the common causes, finish the setup, and end with an outro that says the build verification failed. A build.gradle that can't be written is reported separately and still stops the wizard. execute() now attaches stdout and stderr to its error. Add a gradle-check tag next to gradle-plugin-added. Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…adle-check Resolve the Android wizard test conflicts with #2804 and #2808: keep writeActivity(), which returns the Activity's path, and define main's writeAppWithActivity() on top of it; keep both fs imports; drop the Sentry import that both sides added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BYK
approved these changes
Dec 2, 2026
antonis
added a commit
that referenced
this pull request
Dec 3, 2026
…th-token-warning Resolve the android-wizard.ts conflict with #2805: keep both PRs' constants (GRADLE_PLUGIN_DOCS and the CI env vars) and both PRs' helpers (the token warning helpers and warnGradleCheckFailed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
14 of 16 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sentry wizard androidruns./gradlew(gradlew.baton Windows) after adding the Sentry Gradle plugin. When that build failed, the wizard logged "The Gradle sync failed after adding the Sentry Gradle plugin…" and stopped withabort(). At that point onlybuild.gradlehad changed, so users got a half-done setup and a message blaming Sentry. The build often fails for reasons that have nothing to do with the plugin: Android Gradle plugin 9 needs JDK 17+, and the shell'sjavais often not the JBR Android Studio uses; no network; or a project that was already broken.This is a regression from
@sentry/wizard9.1.0, which warned and continued. It turned up while testing on fresh Android Studio AGP 9 projects (getsentry/sentry-java#6797).What changes:
./gradlewno longer stops the wizard. It warns that the build failed and that the cause may be the build environment rather than the plugin, lists the common causes, shows the last 20 lines of Gradle's stderr (where it printsFAILURE: Build failed with an exceptionand what went wrong), and keeps the docs link for setting up the plugin by hand. The manifest, test snippet, andsentry.propertiessteps still run.execute()attachesstdoutandstderrto the error it rejects with. Its success value is unchanged.addGradlePluginreturns{ pluginAdded, gradleCheck }instead of a boolean. Its onlyreturn falsewas the Gradle failure; there was no path for "the plugin couldn't be added" (a file without aplugins {}block gets one inserted). The one real case is abuild.gradlethe wizard can't write (EACCES/EPERM/EROFS). That now has its own message ("Could not add the Sentry Gradle plugin…"), and still stops the wizard, since the test snippet won't compile without the plugin. Other write errors still throw and get reported.isPermissionErrormoves fromcompletions.tstofs-utils.tsso both can use it.gradle-plugin-addedstays; the newgradle-checktag ispassed,failed, orskipped(plugin already present, or not added).Open question: should a
build.gradlethat can't be written also continue to the manifest step, like 9.1.0 did? This PR keeps stopping there.via Antonis Lilis.
--
View Session [Sentry]