Skip to content

Test the sentry wizard Android port #6797

Done

Description

@antonis

The wizard is being ported into the new CLI as sentry wizard (getsentry/toolkit#2528 for Android and Flutter). sentry init stays as a separate command until the two are merged after v4 (toolkit#2510).

This issue tests the Android port. It confirms the gaps already identified, looks for new ones, and plans the follow-ups. Fixing the gaps is not part of this issue. The fixes go into the follow-ups it produces. Same approach as RN-871 for React Native; the earlier action plan is in JAVA-845.

Gaps identified so far

From a code review of the #2528 branch (packages/cli/src/lib/wizard/android/). None of these have been confirmed by running the port yet.

  1. Only a Logs prompt. Session Replay, User Feedback and profiling are never offered (wizard#829 for profiling).
  2. A test exception is left in the main Activity, inside addOnGlobalLayoutListener (templates.ts:55,66), so it fires on every layout pass, not once.
  3. Release builds without a token may fail. includeSourceContext = true is still written. In RN-868, sentryUploadSourceBundleRelease failed without a valid token, even with SENTRY_DISABLE_AUTO_UPLOAD=true.
  4. No version catalog support. The plugin is written as id("io.sentry.android.gradle") version "…" (gradle.ts:105), never in libs.versions.toml.
  5. Defaults: the deprecated io.sentry.send-default-pii key instead of the io.sentry.data-collection.* keys, and traces.sample-rate = 1.0 with no note to lower it for production.
  6. No non-interactive mode. The flow prompts for the module and for Logs.
  7. The DSN can come from a disabled key: when no key is active, it falls back to keys[0]. Sentry silently drops events sent with a disabled key (WIZARD-65).
  8. The upload setup is still on CLI 3.x. The port writes sentry.properties for the Sentry Android Gradle Plugin, which uploads through sentry-cli, but CLI v4 reads only .sentryclirc. That's on the SAGP side.

Fixed in the port: it uses the first active DSN key.

Not checked yet:

What must keep working

From the legacy Android wizard, 9.1.0:

  • Find the app's build.gradle / build.gradle.kts, and let the user pick one when there are several.
  • Add the Sentry Android Gradle Plugin at the latest version, with a sentry {} block (org, project, includeSourceContext).
  • Add the manifest <meta-data> for the DSN, tracing, screenshots and view hierarchy, plus Logs if chosen.
  • Write the token to sentry.properties.

Done when

  • The options.setSentryClientName should contain the SDK version as well #2528 branch (or the merged port) has been run on fresh Kotlin (Kotlin DSL, version catalog) and Java (Groovy) apps, with Debug and Release builds on an emulator.
  • Each identified gap is confirmed or ruled out by that run.
  • Each "not checked yet" item and each "must keep working" item is marked pass or fail. Each mark says how it was checked: a file check, a build, or an event confirmed in Sentry.
  • Any new gaps found in the run are added to the list above.
  • Every confirmed gap has a follow-up with an owner. Gaps in the port go on the port PR, or become toolkit issues once it has merged. Gaps on the Android SDK or SAGP side become issues in this project.

Activity

  1. linear-code commented on Nov 27, 2026

    @linear-code
  2. self-assigned this
    on Nov 27, 2026
  3. antonis commented on Dec 2, 2026

    @antonis
    ContributorAuthor

    Android wizard: what to fix for it to be usable, by priority

    From the first run (toolkit main ba09503ce, fresh Android Studio AGP 9 projects), updated after the retest on main aafb1e722 (see the comment below). P0 and P1 were the minimum to call it usable; all of the wizard's part is done.

    P0: blocks most users

    P1: setup breaks or misleads in common situations

    P2: works, but not right

    P3: nice to have

    Not checked yet

  4. antonis commented on Dec 3, 2026

    @antonis
    ContributorAuthor

    Retest: sentry wizard android on toolkit main (aafb1e722, packed npm build 0.52.0-dev.0, not released), 2026-12-03

    Same setup as the first run:

    • fresh apps in Android Studio's AGP 9 format: Kotlin + Compose + Kotlin DSL, and Java + Views + Groovy DSL, both with a version catalog;
    • sentry-sdks/sentry-android, default answers, real org token, JDK 17 unless noted;
    • Debug and Release builds on a Pixel 8 emulator (API 37).

    This time the wizard ran with nobody typing an app path. For the Release checks, I added one handled error per app (Sentry.captureException(Exception("WizReleaseTest")) in onCreate, TEST ONLY), since the wizard's test error now runs only in debuggable builds.

    Blockers: none.

    PR Check Result How checked
    getsentry/toolkit#2804 App module found in version-catalog projects ✅ both apps, with no "Unable to find your app's directory" wizard output
    getsentry/toolkit#2805 Shell on JDK 11 ✅ The wizard warns "The Gradle build failed… This may be your build environment rather than the Sentry plugin", names the JDK mismatch ("Android Gradle plugin 9 needs JDK 17 or later"), and shows Gradle's own error ("Gradle requires JVM 17 or later to run…"). It then continues: manifest, Activity and token are all written. It ends with "Sentry Android SDK setup finished, but the Gradle build verification failed." wizard output + git status
    getsentry/toolkit#2803 Test error once, debuggable only ✅ Debug: launch + 4 rotations (5 Activity creations) sent exactly 5 test errors, no extra relayout events. Release: no test error. Snippet nests at 4 spaces and removes its listener. events in Sentry + file check
    getsentry/toolkit#2806 Token warning ✅ After writing sentry.properties: "sentry.properties holds your auth token and is gitignored, so other machines, such as a teammate's clone or CI, don't have it. Release builds there fail at the Sentry upload until a token is available…" plus the settings URL. The outro adds "Release builds on other machines and in CI need SENTRY_AUTH_TOKEN". wizard output
    getsentry/toolkit#2807 io.sentry.data-collection.user-info ✅ written with project sentry-sdks/android. ⚠️ Not written with project sentry-sdks/sentry-android, see below. manifest
    getsentry/toolkit#2808 Tracing, then Logs, then Profiling ✅ The questions come in that order. Defaults add traces.sample-rate, traces.user-interaction.enable, traces.profiling.session-sample-rate = 1.0 and traces.profiling.lifecycle = trace. --no-tracing logs "Profiling: no (it only runs during traces, so it needs Tracing)" and leaves out the tracing and profiling keys. wizard output + manifest

    Still working, end to end

    Item Kotlin Java How checked
    Plugin 6.28.0 + sentry {}, manifest <meta-data>, token in gitignored sentry.properties ✅ ✅ file check
    Debug + Release builds, source bundle uploaded ✅ ✅ build
    Release error symbolicated with source context ✅ MainActivity.onCreate, MainActivity.kt:39 ✅ MainActivity.onCreate, MainActivity.java:36 event in Sentry
    Tracing ✅ ui.load MainActivity per launch ✅ spans dataset
    Profiling ✅ transactions have a profiler.id, and the device log shows the SDK writing a Perfetto trace. No profile chunk in the stats yet during the test window. — spans + logcat
    No terminal: --tracing --logs --profiling --no-mcp < /dev/null ✅ exit 0, success message, no path question — exit code + output

    New, minor

    1. Envelope submission failed/ connect timed out #2807 misses the data-collection key when the Sentry project is named sentry-android (or sentry-android-core, sentry-bom).
      • sdkReadsDataCollection reads the app's build file after the wizard writes sentry { projectName.set("sentry-android") }.
      • SDK_ARTIFACT_NAME_RE (meant for map notation like name: 'sentry-android') matches that quoted project name and counts it as a declared SDK with an unknown version, so the wizard falls back to io.sentry.send-default-pii.
      • Checked: the same app with project android gets io.sentry.data-collection.user-info.
      • Fix: match only name: in map notation, or check the build file before the sentry {} block is added.
    2. Still no screenshot on the Debug test error, although io.sentry.attach-screenshot is on and the snippet now waits for the first layout. Only view-hierarchy.json is attached.

    Still open: see the updated checklist above.

    • Release builds without a token: the plugin fix; the wizard now warns.
    • App-module flag for several modules.
    • Plugin in the version catalog.
    • <meta-data> indentation.
    • Replay and Feedback questions.
    • Screenshot.
    • Library-module Activity.
  5. antonis commented on Dec 3, 2026

    @antonis
    ContributorAuthor

    Closing: the Android port of sentry wizard is usable. The retest above found no blockers on fresh Android Studio AGP 9 projects (Kotlin + Compose + Kotlin DSL, and Java + Views + Groovy DSL, both with a version catalog). Release errors arrive symbolicated with source context, tracing and profiling work, and a run without a terminal finishes with exit code 0.

    Fixed in toolkit after the first run (all merged, confirmed in the retest):

    PR Fix
    getsentry/toolkit#2804 Finds the app module in version-catalog projects (P0)
    getsentry/toolkit#2805 Keeps going when ./gradlew fails, shows Gradle's own error, and no longer blames Sentry (P0)
    getsentry/toolkit#2806 Warns that Release builds on other machines and in CI need SENTRY_AUTH_TOKEN (and SENTRY_URL on self-hosted) (P1)
    getsentry/toolkit#2803 Sends the test error once per Activity creation, only in debuggable builds, indented by 4 spaces (P1)
    getsentry/toolkit#2807 Writes io.sentry.data-collection.user-info instead of the deprecated send-default-pii when the installed SDK reads it
    getsentry/toolkit#2808 Asks Tracing, then Logs, then Profiling only when Tracing is on
    getsentry/toolkit#2789 --no-mcp answers the last question, so runs without a terminal can finish with exit code 0 (shared by all wizards)

    Feature gap closed after the retest:

    PR Fix
    getsentry/toolkit#2832 Asks about Session Replay (--replay), whatever the Tracing answer, and writes io.sentry.session-replay.session-sample-rate = 0.1 and io.sentry.session-replay.on-error-sample-rate = 1.0 to the manifest. Text and images are masked by default.

    The Android wizard now asks Tracing, Logs, Profiling (only with Tracing) and Session Replay, like the other mobile wizards. Not yet checked in a real app: that a replay is attached to an error.

    Known, not blocking:

    • feat(cli): Write io.sentry.data-collection.user-info in the Android wizard toolkit#2807 falls back to send-default-pii when the Sentry project is named after an SDK artifact (sentry-android, sentry-android-core, sentry-bom): the artifact check also matches the projectName the wizard writes into sentry {}. A small follow-up in toolkit.
    • No screenshot on the Debug test error, though attach-screenshot is on. Likely because the error is sent after the first layout but before the first draw; to confirm with the Android SDK team.

    Parked:

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions