Depth lives in the skills.
code-guidelines(.agents/skills/, esp.references/native-bridge.md) is authoritative for bridge and native conventions — load it before non-trivial work. This file is the quick reference for the Android surface; where a convention here overlaps a skill, the skill wins.
| Task | Command |
|---|---|
| Java format (Google Java Format) | yarn fix:android |
| Kotlin format (ktlint) | yarn fix:kotlin |
| Java lint check | yarn lint:android |
| Kotlin lint check | yarn lint:kotlin |
| PMD static analysis | yarn java:pmd |
- Use Google Java Format (enforced by CI)
- Package structure:
io.sentry.react.* - Null safety: Use
@Nullableand@NonNullannotations
- Use ktlint formatting (enforced by CI)
- Prefer Kotlin idioms (data classes, extension functions, etc.)
Android native code supports both React Native architectures — a bridge-method change usually has to land in both:
src/oldarch/— Legacy bridge implementationsrc/newarch/— TurboModule / Fabric implementationsrc/main/— Shared code (io.sentry.react)
Catch Throwable at the boundary — not just Exception, so an Error can't crash the app either (the module code catches Throwable throughout) — and reject with the shared "SentryReactNative" code, not a per-method one:
@ReactMethod
public void nativeOperation(String param, Promise promise) {
try {
boolean result = performOperation(param);
promise.resolve(result);
} catch (Throwable e) {
promise.reject("SentryReactNative", e.getMessage(), e);
}
}✅ Always
- Land a bridge-method change in both
src/oldarch/andsrc/newarch/— one arch is not done. - Catch
Throwableat every@ReactMethodandpromise.reject(...)— an uncaught throwable crashes the host app. - Gate any user data added to events/breadcrumbs/spans on
sendDefaultPii.
🚫 Never
- Change the codegen bridge ABI without mirroring it in JS + iOS and keeping it backward-compatible with an older cached native binary.
- Bump the bundled
io.sentry:sentry-androidversion by hand — go throughscripts/update-android.sh.
- Build sentry-java:
cd sentry-java && make dryRelease - Add
mavenLocal()to sample'sandroid/build.gradle - Update version to locally published version