fix: graceful degradation when native libraries are unavailable (Android)#1067
Open
radko93 wants to merge 1 commit intosoftware-mansion:mainfrom
Open
fix: graceful degradation when native libraries are unavailable (Android)#1067radko93 wants to merge 1 commit intosoftware-mansion:mainfrom
radko93 wants to merge 1 commit intosoftware-mansion:mainfrom
Conversation
…oid) On 32-bit Android devices (or devices with 64-bit CPUs running 32-bit userspace), the arm64-v8a native .so files are not found and ETInstaller throws RuntimeException wrapping UnsatisfiedLinkError, crashing the app at startup. Add ETInstallerUnavailable, a fallback TurboModule whose install() returns false. RnExecutorchPackage returns it when the native library fails to load, so JS sees a real linked module but globals are never injected. This preserves the existing linking-error Proxy for genuinely mislinked installs on supported devices. Export isAvailable (based on loadExecutorchModule global presence) so consumers can check runtime support. No public API break; preserves existing mislink failure behavior. Fixes software-mansion#1065
Member
|
Ok, it took us some time to find a suitable device to test these changes, but we will be testing in a while :)) |
Member
|
Hmm, I turned out that it will be a challenge for us. The motorola that we had is from 2016 with android 7 😅. For now, we don't have any device that has 32-bit arch to test it :/ |
Contributor
Author
|
@msluszniak we don't have a device like that either. But a similar solution made crashes disappear at scale. There are also some devices that are 64bit but apparently run or on 32 bit. Try to Google, especially Samsung A13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On 32-bit Android devices (or devices with 64-bit CPUs running 32-bit userspace), the
arm64-v8anative.sofiles are not found.ETInstaller.initthrowsRuntimeExceptionwrappingUnsatisfiedLinkError, crashing the app at startup with no consumer-side escape hatch.This PR adds a fallback TurboModule (
ETInstallerUnavailable) whoseinstall()returnsfalse.RnExecutorchPackagereturns it only when the native library fails to load, so JS sees a real linked module but JSI bindings are never injected. This preserves the existing linking-error Proxy for genuinely mislinked installs on supported devices.Unsupported ABI: real module exists →
install()returnsfalse→ globals not set →isAvailableisfalseSupported but mislinked: module is
null→ existing Proxy throws linking error (unchanged)No public API break; preserves existing mislink failure behavior.
isAvailableis a new additive export.Introduces a breaking change?
Type of change
Tested on
Testing instructions
isAvailableshould befalseRelated issues
Fixes #1065