Title: 8.61.1 fails to dex on AGP 8.0 and older: D8 NullPointerException "Cannot invoke String.length()" · Issue #6355 · getsentry/sentry-java · GitHub
Open Graph Title: 8.61.1 fails to dex on AGP 8.0 and older: D8 NullPointerException "Cannot invoke String.length()" · Issue #6355 · getsentry/sentry-java
X Title: 8.61.1 fails to dex on AGP 8.0 and older: D8 NullPointerException "Cannot invoke String.length()" · Issue #6355 · getsentry/sentry-java
Description: Description Starting with 8.61.1, Android release builds that use D8 older than 8.1 (AGP 8.0 and older) fail in mergeExtDexRelease while dexing io.sentry:sentry and io.sentry:sentry-android-core: D8: java.lang.NullPointerException: Canno...
Open Graph Description: Description Starting with 8.61.1, Android release builds that use D8 older than 8.1 (AGP 8.0 and older) fail in mergeExtDexRelease while dexing io.sentry:sentry and io.sentry:sentry-android-core: D...
X Description: Description Starting with 8.61.1, Android release builds that use D8 older than 8.1 (AGP 8.0 and older) fail in mergeExtDexRelease while dexing io.sentry:sentry and io.sentry:sentry-android-core: D...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/6355
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"8.61.1 fails to dex on AGP 8.0 and older: D8 NullPointerException \"Cannot invoke String.length()\"","articleBody":"## Description\n\nStarting with 8.61.1, Android release builds that use D8 older than 8.1 (AGP 8.0 and older) fail in `mergeExtDexRelease` while dexing `io.sentry:sentry` and `io.sentry:sentry-android-core`:\n\n```\nD8: java.lang.NullPointerException: Cannot invoke \"String.length()\" because \"\u003cparameter1>\" is null\n```\n\nWe found it in the React Native SDK's RN 0.71 E2E build ([failing job](https://github.com/getsentry/sentry-react-native/actions/runs/39760830318/job/119778444811)) and reverted the bump there in getsentry/sentry-react-native#6931. It is not RN specific: any Android app whose build uses D8 \u003c 8.1 is affected, no matter the framework.\n\n## Root cause\n\n#6242 moved compilation to a JDK 21 toolchain. Since JDK 21 ([JDK-8292275](https://bugs.openjdk.org/browse/JDK-8292275)), javac writes a `MethodParameters` attribute for methods with synthetic or mandated parameters, such as bridge methods, even without `-parameters`. These entries carry flags but no name. As far as we can tell, javac has no option to turn this off.\n\nExample from the published `sentry-8.61.1.jar`, `io.sentry.SentryLogLevel$Deserializer`:\n\n```\npublic java.lang.Object deserialize(io.sentry.ObjectReader, io.sentry.ILogger) throws java.lang.Exception;\n flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC\n ...\n MethodParameters:\n Name Flags\n \u003cno name> synthetic\n \u003cno name> synthetic\n```\n\nOlder D8 versions read the null name and crash.\n\nClasses with a `MethodParameters` attribute (checked with `javap -v` on the Maven Central artifacts):\n\n| Artifact | 8.61.0 | 8.61.1 |\n|---|---|---|\n| `sentry` | 0 / 782 | 141 / 782 |\n| `sentry-android-core` | 0 / 219 | 25 / 223 |\n\n## D8 compatibility\n\nA class compiled with javac 21, run through the newest release of each D8 line:\n\n| D8 | AGP | Result |\n|---|---|---|\n| 3.3.75 | 7.3 | NPE |\n| 4.0.63 | 7.4 | NPE |\n| 8.0.40 | 8.0 | NPE |\n| 8.1.72 | 8.1 | OK |\n| 8.2.47 | 8.2 | OK |\n\n## Reproduction\n\nEither build any AGP 7.3.1 app that depends on `io.sentry:sentry-android:8.61.1` with `./gradlew assembleRelease`, or run D8 directly, no Gradle needed:\n\n```sh\ncurl -LO https://maven.google.com/com/android/tools/r8/3.3.75/r8-3.3.75.jar\ncurl -LO https://repo1.maven.org/maven2/io/sentry/sentry/8.61.1/sentry-8.61.1.jar\nmkdir out\njava -cp r8-3.3.75.jar com.android.tools.r8.D8 --release --min-api 21 \\\n --lib $ANDROID_HOME/platforms/android-\u003capi>/android.jar --output out sentry-8.61.1.jar\n```\n\nThe same command succeeds with `sentry-8.61.0.jar`.\n\n## Proposed fix\n\nRemove the `MethodParameters` attribute from the main Java classes of published modules after `JavaCompile`, using ASM (already on the build classpath through AGP, same version 9.9). Without `-parameters` the attribute only holds these nameless entries, so nothing the SDK relies on is lost, and the output matches what javac 17 produced. Kotlin code is unaffected, because kotlinc doesn't write the attribute unless `-java-parameters` is set.\n\nWe didn't go with `-parameters`: it would add the attribute, with names, to every method of every published class, which makes the jars and dex output bigger, and we haven't verified that it avoids the nameless entries for synthetic parameters.\n\nVerified locally with the fix:\n- 0 classes with `MethodParameters` in the `sentry` jar and the `sentry-android-core` AAR\n- both dex cleanly with D8 3.3.75, while the published 8.61.1 jar fails with the NPE above\n- the attribute stays stripped after a forced recompile (`--rerun`), with configuration cache enabled\n\n## Impact\n\n- **React Native:** the peer range is `react-native >=0.65.0`. RN 0.72 and older default to AGP 7.x, so those apps fail their release builds on an RN SDK version that bundles 8.61.1. RN stays on 8.61.0 until a fixed release is out.","author":{"url":"https://github.com/antonis","@type":"Person","name":"antonis"},"datePublished":"2026-10-22T11:39:37Z","url":"https://github.com/getsentry/sentry-java/issues/6355"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a7196247-7b2b-e20a-a816-e7996c9d0be6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB3A:D1D86:28FED:385FB:6B046147 |
| html-safe-nonce | eb327a76fd14b19854378910642833905d5b364760cb23bb070e0dfa711ae111 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjNBOkQxRDg2OjI4RkVEOjM4NUZCOjZCMDQ2MTQ3IiwidmlzaXRvcl9pZCI6IjQ3MDI2MjcwMzA2ODMxMTU4NDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4482a034318befd7971bbdb0a3d08ba78b278caefc48aa6963d8330f4881fcec |
| hovercard-subject-tag | issue:5978576252 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/6355/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e7ac24fe6b04ab346d79e5e5c62e1c1bb64f6d39bb44eb61b8aca39b729427f5/getsentry/sentry-java/issues/6355 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e7ac24fe6b04ab346d79e5e5c62e1c1bb64f6d39bb44eb61b8aca39b729427f5/getsentry/sentry-java/issues/6355 |
| og:image:alt | Description Starting with 8.61.1, Android release builds that use D8 older than 8.1 (AGP 8.0 and older) fail in mergeExtDexRelease while dexing io.sentry:sentry and io.sentry:sentry-android-core: D... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | antonis |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width