fix(android): preserve HybridNitroNetworkInfo in R8 builds - #122
fix(android): preserve HybridNitroNetworkInfo in R8 builds#122maksymhcode-care wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Android module imports ChangesAndroid class preservation
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized change preserves the hybrid class and constructor in minified Android releases, with the stated checks and release verification completed; no actionable merge-blocking risk remains beyond normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
@DoNotStripProblem
NitroNetworkInfoOnLoad.cppcreatesHybridNitroNetworkInfothrough the hardcoded JNI descriptorLcom/nitronetworkinfo/HybridNitroNetworkInfo;. Because the implementation had no shrinker annotation and no direct Java/Kotlin construction path, R8 could remove it from consumer release builds while retaining the generated spec.Affected builds crash when the hybrid object is initialized:
Debug builds are unaffected because they normally do not run R8.
Fix
Annotate the implementation with React Native's existing
@DoNotStripannotation. This matches the convention already used by the generated Nitro classes and adds no dependency or API change.Verification
bun run typecheckbun run buildminifyEnabled trueand x86_64 native architectureHybridNitroNetworkInfoto its original nameusage.txtSummary by CodeRabbit