Skip to content

fix: dex loader parent injection release vs debug#1964

Open
NathanWalker wants to merge 1 commit into
mainfrom
fix/dex-loader-release-mode
Open

fix: dex loader parent injection release vs debug#1964
NathanWalker wants to merge 1 commit into
mainfrom
fix/dex-loader-release-mode

Conversation

@NathanWalker
Copy link
Copy Markdown
Contributor

@NathanWalker NathanWalker commented Jun 8, 2026

  • control whether runtime-generated classes are injected into the parent class loader based on whether the app is running in debug mode on the main thread, improving class loader behavior for debug scenarios while avoiding issues in release builds.

closes #1962

Summary by CodeRabbit

Bug Fixes

  • Refined class loader behavior to properly handle debuggable and release builds, enhancing app stability and isolation across different build configurations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 8, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d3d012e5-870d-4f09-bdf5-af166b3f3124

📥 Commits

Reviewing files that changed from the base of the PR and between d0afd1e and 716727f.

📒 Files selected for processing (1)
  • test-app/runtime/src/main/java/com/tns/Runtime.java

📝 Walkthrough

Walkthrough

Runtime.init() now gates parent-classloader injection for generated proxy classes to debuggable builds only. The injectIntoParentClassLoader flag is set to isMainThread && isDebuggable and passed to DexFactory, ensuring release builds use the isolated DexClassLoader approach instead.

Changes

Parent-classloader injection gating for release builds

Layer / File(s) Summary
Restrict parent-classloader injection to debuggable builds
test-app/runtime/src/main/java/com/tns/Runtime.java
An injectIntoParentClassLoader boolean is introduced, set to isMainThread && isDebuggable, and passed to the DexFactory constructor instead of the previous unconditional isMainThread flag. Inline comments document that debug/HMR use cases benefit from injection, while release builds maintain isolation to avoid double-registration crashes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A debug build dances through a parent's wide gate,
While release steps back—isolation's the fate.
One dex, one loader, no crashes in sight,
A hop and a skip keeps the runtime just right. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding conditional parent-classloader injection based on debug status versus release.
Linked Issues check ✅ Passed The change addresses issue #1962 by making parent-classloader injection conditional on both main thread and debuggable status, implementing option (2) from the suggested direction.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the parent-classloader injection issue; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

DexFactory parent class loader injection (#1951) crashes release builds with "Attempt to register dex file ... with multiple class loaders"

1 participant