react-native: java.lang.UnsatisfiedLinkError: dlopen failed: library "libappmodules.so" not found
Description
Getting below error in android after upgrading to react-native version 0.72.3. App builds successfully and when I open app it crashes on native side.
FATAL EXCEPTION: main Process: fit.sugar.android.debug, PID: 17748 java.lang.UnsatisfiedLinkError: dlopen failed: library “libappmodules.so” not found at java.lang.Runtime.loadLibrary0(Runtime.java:1087) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java:24) at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52) at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869) at com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load(DefaultNewArchitectureEntryPoint.kt:41) at com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load$default(DefaultNewArchitectureEntryPoint.kt:27) at com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load(Unknown Source:2) at fit.cure.android.MainApplication.onCreate(MainApplication.java:89) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712) at android.app.ActivityThread.access$1300(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
React Native Version
0.72.3
Output of npx react-native info
System: OS: macOS 13.0.1 CPU: (10) arm64 Apple M1 Pro Memory: 108.11 MB / 16.00 GB Shell: version: 5.8.1 path: /bin/zsh Binaries: Node: version: 16.14.0 path: ~/.nvm/versions/node/v16.14.0/bin/node Yarn: version: 1.22.17 path: /opt/homebrew/bin/yarn npm: version: 8.3.1 path: ~/.nvm/versions/node/v16.14.0/bin/npm Watchman: version: 2023.07.10.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Not Found Android SDK: API Levels: - “19” - “28” - “29” - “30” - “31” - “32” - “33” - “34” Build Tools: - 28.0.3 - 29.0.2 - 30.0.1 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 33.0.0 - 33.0.1 - 33.0.2 System Images: - android-29 | Intel x86 Atom_64 - android-29 | Google APIs Intel x86 Atom - android-30 | Google APIs ARM 64 v8a - android-31 | Google APIs ARM 64 v8a Android NDK: 23.1.7779620 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: version: /undefined path: /usr/bin/xcodebuild Languages: Java: version: 11.0.12 path: /opt/homebrew/opt/openjdk@11/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.3 wanted: 0.72.3 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: false
Steps to reproduce
Upgraded my application react native version from 0.66.3 to 0.72.3 Apply all the changes suggested in upgrade helper
Snack, code example, screenshot, or link to a repository
Here is my build.gradle file,
apply plugin: "com.android.application"
apply plugin: "nebula.dependency-lock"
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "com.facebook.react"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "./env.gradle"
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
debuggableVariants = ["debugSugarfit"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = true
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
android {
// dynamicFeatures = [":twilioVideo"]
ndkVersion rootProject.ext.ndkVersion
configurations.all {
exclude group: 'com.facebook.react:react-native'
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion buildToolsVersion
namespace 'fit.cure.android'
defaultConfig {
applicationId = project.env.get("BUNDLE_ID")
minSdkVersion rootProject.ext.minSDKVersion
targetSdkVersion rootProject.ext.targetSDKVersion
versionCode = project.env.get("BUILD_VERSION").toInteger()
versionName = project.env.get("APP_VERSION")
archivesBaseName = "${project.env.get("APP_ID")}-$versionName"
missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
resConfigs "en"
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
vectorDrawables.useSupportLibrary = true
resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
abortOnError false
}
kotlinOptions {
jvmTarget = "11"
}
signingConfigs {
debug {
storeFile file(CUREFIT_DEBUG_STORE_FILE)
storePassword CUREFIT_DEBUG_STORE_PASSWORD
keyAlias CUREFIT_DEBUG_KEY_ALIAS
keyPassword CUREFIT_DEBUG_KEY_PASSWORD
}
release {
storeFile file(CUREFIT_RELEASE_STORE_FILE)
storePassword CUREFIT_RELEASE_STORE_PASSWORD
keyAlias CUREFIT_RELEASE_KEY_ALIAS
keyPassword CUREFIT_RELEASE_KEY_PASSWORD
}
debugSugarfit {
storeFile file(SUGARFIT_DEBUG_STORE_FILE)
storePassword SUGARFIT_DEBUG_STORE_PASSWORD
keyAlias SUGARFIT_DEBUG_KEY_ALIAS
keyPassword SUGARFIT_DEBUG_KEY_PASSWORD
}
releaseSugarfit {
storeFile file(SUGARFIT_RELEASE_STORE_FILE)
storePassword SUGARFIT_RELEASE_STORE_PASSWORD
keyAlias SUGARFIT_RELEASE_KEY_ALIAS
keyPassword SUGARFIT_RELEASE_KEY_PASSWORD
}
}
bundle {
language {
enableSplit = true
}
density {
enableSplit = true
}
abi {
enableSplit = true
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
proguardFile 'proguard-rules.pro'
resValue "string", "CodePushDeploymentKey", project.env.get("CODEPUSH_KEY_RELEASE")
resValue "string", "sync_account_type", project.env.get("BUNDLE_ID")
resValue "string", "content_authority", "${project.env.get('BUNDLE_ID')}.provider"
resValue "string", "file_content_authority", "${project.env.get('BUNDLE_ID')}.file.provider"
buildConfigField "String", "SYNC_ACCOUNT_TYPE", CUREFIT_RELEASE_SYNC_ACCOUNT_TYPE
buildConfigField "String", "CONTENT_AUTHORITY", CUREFIT_RELEASE_CONTENT_AUTHORITY
buildConfigField "String", "FILE_CONTENT_AUTHORITY", CUREFIT_RELEASE_FILE_CONTENT_AUTHORITY
resValue "string", "sensor_data_content_provider", "${project.env.get('BUNDLE_ID')}.provider"
resValue "string", "app_name", project.env.get("APP_NAME")
resValue "string", "tray__authority", android.defaultConfig.applicationId + ".tray"
}
//debug code push key should be empty
debug {
proguardFile 'proguard-rules.pro'
applicationIdSuffix ".debug"
signingConfig signingConfigs.debug
resValue "string", "CodePushDeploymentKey", project.env.get("CODEPUSH_KEY_DF")
resValue "string", "sync_account_type", "${project.env.get('BUNDLE_ID')}.debug"
resValue "string", "content_authority", "${project.env.get('BUNDLE_ID')}.debug.provider"
resValue "string", "file_content_authority", "${project.env.get('BUNDLE_ID')}.debug.file.provider"
buildConfigField "String", "SYNC_ACCOUNT_TYPE", CUREFIT_DEBUG_SYNC_ACCOUNT_TYPE
buildConfigField "String", "CONTENT_AUTHORITY", CUREFIT_DEBUG_CONTENT_AUTHORITY
buildConfigField "String", "FILE_CONTENT_AUTHORITY", CUREFIT_DEBUG_FILE_CONTENT_AUTHORITY
resValue "string", "app_name", "${project.env.get('APP_NAME')}-debug"
resValue "string", "tray__authority", (android.defaultConfig.applicationId + ".debug.tray")
matchingFallbacks = ['debug', 'release', 'stage']
}
releaseSugarfit {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.releaseSugarfit
proguardFile 'proguard-rules.pro'
resValue "string", "CodePushDeploymentKey", project.env.get("CODEPUSH_KEY_RELEASE")
resValue "string", "sync_account_type", project.env.get("BUNDLE_ID")
resValue "string", "content_authority", "${project.env.get('BUNDLE_ID')}.provider"
resValue "string", "file_content_authority", "${project.env.get('BUNDLE_ID')}.file.provider"
buildConfigField "String", "SYNC_ACCOUNT_TYPE", SUGARFIT_RELEASE_SYNC_ACCOUNT_TYPE
buildConfigField "String", "CONTENT_AUTHORITY", SUGARFIT_RELEASE_CONTENT_AUTHORITY
buildConfigField "String", "FILE_CONTENT_AUTHORITY", SUGARFIT_RELEASE_FILE_CONTENT_AUTHORITY
resValue "string", "sensor_data_content_provider", "${project.env.get('BUNDLE_ID')}.provider"
resValue "string", "app_name", project.env.get("APP_NAME")
resValue "string", "tray__authority", android.defaultConfig.applicationId + ".tray"
matchingFallbacks = ['release']
}
//debug code push key should be empty
debugSugarfit {
proguardFile 'proguard-rules.pro'
applicationIdSuffix ".debug"
debuggable true
signingConfig signingConfigs.debugSugarfit
resValue "string", "CodePushDeploymentKey", project.env.get("CODEPUSH_KEY_DF")
resValue "string", "sync_account_type", "${project.env.get('BUNDLE_ID')}.debug"
resValue "string", "content_authority", "${project.env.get('BUNDLE_ID')}.debug.provider"
resValue "string", "file_content_authority", "${project.env.get('BUNDLE_ID')}.debug.file.provider"
buildConfigField "String", "SYNC_ACCOUNT_TYPE", SUGARFIT_DEBUG_SYNC_ACCOUNT_TYPE
buildConfigField "String", "CONTENT_AUTHORITY", SUGARFIT_DEBUG_CONTENT_AUTHORITY
buildConfigField "String", "FILE_CONTENT_AUTHORITY", SUGARFIT_DEBUG_FILE_CONTENT_AUTHORITY
resValue "string", "app_name", "${project.env.get('APP_NAME')} (Debug)"
resValue "string", "tray__authority", (android.defaultConfig.applicationId + ".debug.tray")
matchingFallbacks = ['debug', 'stage', 'release']
}
}
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
packagingOptions {
// Required by Qualcomm SNPE SDK: snpe-release & platform-validator
// https://developer.qualcomm.com/docs/snpe/android_tutorial.html
pickFirst 'lib/armeabi-v7a/libsymphony-cpu.so'
pickFirst 'lib/arm64-v8a/libsymphony-cpu.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
pickFirst '**/x86_64/libjsc.so'
pickFirst '**/arm64-v8a/libjsc.so'
pickFirst '**/*.so'
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
compileOptions {
sourceCompatibility 11
targetCompatibility 11
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.30"
// camerax
def camerax_version = '1.0.0-rc01'
def camerax_view_version = '1.0.0-alpha20'
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-view:${camerax_view_version}"
//mlkit
def mlkit_version = "16.0.3"
implementation "com.google.mlkit:face-detection:${mlkit_version}"
//socket
implementation "com.neovisionaries:nv-websocket-client:2.4"
//opencv
def opencv_version = '4.3.0'
implementation "com.github.iamareebjamal:opencv-android:${opencv_version}"
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:18.2.6'
// Recommended: Add the Google Analytics SDK.
implementation 'com.google.firebase:firebase-analytics:20.0.1'
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
implementation project(':twilioVideo')
implementation "com.twilio:video-android:7.6.3"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation 'in.juspay:hypersdk:2.1.6-rc.01'
implementation project(':PayWithAmazon')
implementation project(':react-native-system-setting')
implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.github.checkout:frames-android:v2.0.5'
implementation 'com.android.installreferrer:installreferrer:2.1'
implementation(project(':lottie-react-native')) {
exclude group: "com.airbnb.android:lottie"
}
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation "phonepe.intentsdk.android.release:IntentSDK:0.1.5"
implementation files('libs/PGSDK_v1.0.1.jar')
implementation 'commons-io:commons-io:2.6'
implementation 'net.grandcentrix.tray:tray:0.11.1'
implementation "com.google.firebase:firebase-messaging:23.0.0"
implementation "com.google.android.gms:play-services-base:18.0.1"
implementation "com.google.android.gms:play-services-cast-framework:21.0.0"
implementation 'com.1gravity:android-contactpicker:1.3.2'
implementation "com.twilio:accessmanager-android:0.1.0"
implementation 'androidx.work:work-runtime:2.8.0'
implementation 'androidx.work:work-runtime-ktx:2.8.0'
implementation("com.twilio:chat-android:7.0.1") {
exclude group: "org.apache.directory.studio"
}
implementation ("com.google.android.gms:play-services-location:19.0.0")
// For animated GIF support
implementation 'com.google.android.play:core:1.9.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation(project(':react-native-pose-estimation')) {
exclude group: "com.google.android.exoplayer"
}
implementation 'com.facebook.fresco:fresco:2.6.0' // for rendering gifs
implementation 'com.facebook.fresco:animated-webp:2.6.0'
implementation 'com.facebook.fresco:webpsupport:2.6.0'
implementation 'com.android.billingclient:billing:4.1.0'
}
apply plugin: "com.google.gms.google-services"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'hypersdk-asset-plugin'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
@cortinico Please find this reproducer project https://github.com/prince-sugarfit/rn-android-reproducer
I have added cpp lib to the base template & enabled the new architecture, check the last commit