FG
๐Ÿ“ฑ Mobile & Cross-Platform

[ANDROID] SoLoader error using App Bundle

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score95%
95%

Problem

๐Ÿ› Bug Report Please help! There are some crashes happening in android using app bundle but I am not sure how to reproduce it. It happens on our app with daily crash of 200 users. [code block] The errors have multiple variations that occur on various android versions. [code block] [code block] [code block] To Reproduce We have tried to reproduce it with many devices but we can only reproduce it in one condition. 1. Install the release app 2. Upgrade OS from 32bit to 64bit 3. Open the app If we reinstall the app afterwards, it works fine. Although, we are still unsure whether it is the only error case. Expected Behavior The app does not crash on any device. Code Example [code block] Environment [code block]

Error Output

Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Fix SoLoader UnsatisfiedLinkError in App Bundle

Medium Risk

The error occurs due to the SoLoader not being able to locate the native library 'libreactnativejni.so' after an OS upgrade from 32-bit to 64-bit. This is likely due to the app bundle not correctly loading native libraries in the new architecture context, leading to crashes when the app is launched.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update SoLoader Initialization

    Ensure that SoLoader is initialized correctly in your MainApplication.java. This includes specifying the correct native library paths and ensuring that the libraries are loaded for both 32-bit and 64-bit architectures.

    java
    SoLoader.init(this, /* native exopackage */ false);
  2. 2

    Add ABI Filters

    Modify your build.gradle file to include ABI filters for the architectures you want to support. This ensures that the correct native libraries are packaged with your app bundle.

    groovy
    android {
        defaultConfig {
            ndk {
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
            }
        }
    }
  3. 3

    Rebuild the App Bundle

    After making the changes, rebuild your app bundle to ensure that the new configurations are applied. Use the command below to generate the new app bundle.

    bash
    ./gradlew bundleRelease
  4. 4

    Test on Multiple Devices

    Deploy the updated app bundle to multiple devices with different architectures and Android versions to ensure that the issue is resolved. Pay special attention to devices that previously experienced the crash.

    bash
    adb install -r app-release.aab
  5. 5

    Monitor Crash Reports

    After deployment, monitor crash reports from users to confirm that the issue has been resolved. Use tools like Firebase Crashlytics to track any remaining crashes related to SoLoader.

    bash
    firebase crashlytics:log 'Monitoring SoLoader crashes'

Validation

Confirm the fix by checking that no new crashes related to 'libreactnativejni.so' occur in the crash reports after the app update. Additionally, verify that the app runs smoothly on devices that previously experienced the issue.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

react-nativemobileiosandroidstaleplatform:-androidtech:-bundler-๐Ÿ“ฆbug