Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found #25537

Closed
mhrpatel12 opened this issue Jul 7, 2019 · 189 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@mhrpatel12
Copy link

mhrpatel12 commented Jul 7, 2019

App crash on Android integration with existing apps.

Crash log.

E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
2019-07-07 18:59:27.223 10045-10073/com.mihir.reactApp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.mihir.reactApp, PID: 10045
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
        at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
        at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
        at java.lang.Thread.run(Thread.java:764)

React Native version:

System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 1.19 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.5.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29
Build Tools: 23.0.1, 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.0, 29.0.0
System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.0 => 0.60.0
npmGlobalPackages:
react-native-cli: 2.0.1

Steps To Reproduce

  1. Create a new Android app which uses AndroidX.
  2. Add react-native to Android application as,
    implementation 'com.facebook.react:react-native:+'
  3. Run app on any android device/emulator.

Sample project on GitHub which reproduces crash.

@mhrpatel12 mhrpatel12 added the Bug label Jul 7, 2019
@mhrpatel12
Copy link
Author

@nicsachin For me, it's still not working. Did you tried running the sample project I've shared?

@crispywong
Copy link

hi @mhrpatel12 ,

I'm having same issue. You can follow this link.

Add following code in build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

@ithustle
Copy link

ithustle commented Jul 8, 2019

def useIntlJsc = false

Still no working,,,

@BrendonSled
Copy link

View the upgrade guide
https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0

You're likely missing the step android/build.gradle

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        google()
        jcenter()
    }
}

@mhrpatel12
Copy link
Author

I'm not migrating from .59 to .60. This issue happens even on a brand new android project which uses AndroidX.
You can see for yourself on sample project I created.

@Villar74
Copy link

Villar74 commented Jul 9, 2019

Duplicate of #25415

@BrendonSled
Copy link

@mhrpatel12 check out your file though.
https://github.com/mhrpatel12/ReactApplication/blob/master/android/build.gradle

You're missing pieces

@mhrpatel12
Copy link
Author

@BrendonSled Were you able to run the app successfully after making those changes?
For me, even after merging your changes it's not working.

@chrisspankroy
Copy link

@mhrpatel12 Have you made sure $rootDir/../node_modules/jsc-android/dist is a valid path in your project? If not, you need to do an npm install --save jsc-android

@mhrpatel12
Copy link
Author

@chrisspankroy yes, I have made sure that $rootDir/../node_modules/jsc-android/dist is a valid path in my project. I also did npm install --save jsc-android to double-check. Still, I'm getting the same issue.
It'll be really helpful if you can share your working example repo.

@crispywong
Copy link

Could you give it a try? I tried using your sample project. After done following changes, it works at my side

Add MainApplication.kt file and follow changes in diff.txt

package com.mihir.reactApp

import android.app.Application
import com.facebook.react.ReactApplication
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.shell.MainReactPackage
import com.facebook.soloader.SoLoader
import java.util.Arrays

class MainApplication : Application(), ReactApplication {
    private val mReactNativeHost = object : ReactNativeHost(this) {
        override fun getJSMainModuleName(): String {
            return "index"
        }

        override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
        override fun getPackages(): List<ReactPackage> =
                Arrays.asList(
                        MainReactPackage()
                )
    }

    override fun getReactNativeHost(): ReactNativeHost = mReactNativeHost
    override fun onCreate() {
        super.onCreate()
        SoLoader.init(this, false)
    }
}

diff.txt
helloworld
permission

@mhrpatel12
Copy link
Author

@crispywong thank you, it's working now.
Still, I'm confused what's going on, why I'm able to run perfectly on version 0.59.10 without all these changes?

@Villar74
Copy link

Villar74 commented Jul 10, 2019

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

@ahong222
Copy link

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

it is work for me, thanks

@rochapablo
Copy link

Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libhermes.so
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName + 738(SoLoader.java:738)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName + 591(SoLoader.java:591)
       at com.facebook.soloader.SoLoader.loadLibrary + 529(SoLoader.java:529)
       at com.facebook.soloader.SoLoader.loadLibrary + 484(SoLoader.java:484)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit> + 20(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create + 27(HermesExecutorFactory.java:27)
       at com.facebook.react.ReactInstanceManager$5.run + 949(ReactInstanceManager.java:949)
       at java.lang.Thread.run + 818(Thread.java:818)
"react": "16.8.6",
"react-native": "0.60.4",

@crispywong
Copy link

Did you add below in android/app/build.gradle?

def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }

@tianzige666
Copy link

在app / build.gradle中添加以下代码

def useIntlJsc = false

在依赖中添加以下内容

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

对我来说,修复过

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

在build.gradle中

这对我有用,谢谢
this fixed my problem.

@abhijeetkharat
Copy link

Add following code in app/build.gradle

def useIntlJsc = false

in dependency add in following

if (useIntlJsc) {
     implementation 'org.webkit:android-jsc-intl:+'
} else {
     implementation 'org.webkit:android-jsc:+'
}

For me worked that fix with

maven {
      // Android JSC is installed from npm
      url("$rootDir/../node_modules/jsc-android/dist")
    }

in build.gradle

@Villar74 thanks its work for me.

@yurykorzun
Copy link
Contributor

if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist

Make sure it is included in your dependencies

@william-normann
Copy link

william-normann commented Oct 30, 2019

I think if peoples sure that config for android correct. So, check your android/app/build.gradle

If have two lines after:

    pickFirst '**/x86_64/libjsc.so'
    pickFirst '**/arm64-v8a/libjsc.so'

Remove it resolved my problem. So hope it will help all you guys

Replace your packagingOptions with values from default RN config

packagingOptions {
            pickFirst '**/armeabi-v7a/libc++_shared.so'
            pickFirst '**/x86/libc++_shared.so'
            pickFirst '**/arm64-v8a/libc++_shared.so'
            pickFirst '**/x86_64/libc++_shared.so'
            pickFirst '**/x86/libjsc.so'
            pickFirst '**/armeabi-v7a/libjsc.so'
}

@roots-ai
Copy link

@yurykorzun

if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist

Make sure it is included in your dependencies

How?

@zhuweideng
Copy link

zhuweideng commented Oct 31, 2019

check your android/app/build.gradle

android {
   ...
   packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'
    }
}

@roots-ai
Copy link

roots-ai commented Nov 5, 2019

@zhuweideng Thanks

@chanphiromsok
Copy link

Facing the same issue in an Expo project, any solution for this ?

"react-native": "0.72.3",
"expo": "49.0.7",
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.thrilld.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.statemachine.UpdatesStateContext.getWritableMap(UpdatesStateContext.kt:53)
       at expo.modules.updates.UpdatesController.sendUpdateStateChangeEventToBridge(UpdatesController.kt:561)
       at expo.modules.updates.statemachine.UpdatesStateMachine.sendChangeEventToJS(UpdatesStateMachine.kt:65)
       at expo.modules.updates.statemachine.UpdatesStateMachine.processEvent(UpdatesStateMachine.kt:47)
       at expo.modules.updates.UpdatesController$start$1.onRemoteCheckForUpdateStarted(UpdatesController.kt:285)
       at expo.modules.updates.loader.LoaderTask.launchRemoteUpdateInBackground$lambda$1(LoaderTask.kt:313)
       at expo.modules.updates.loader.LoaderTask.$r8$lambda$jwzCL9xjo0jbCNnExNO-hPCX6iI()
       at expo.modules.updates.loader.LoaderTask$$ExternalSyntheticLambda1.run(:6)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

me too I ++
Screen Shot 2023-09-21 at 9 51 22 AM

@chennighan
Copy link

Facing the same issue in an Expo project, any solution for this ?

"react-native": "0.72.3",
"expo": "49.0.7",
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libreact_render_runtimescheduler.so caused by: couldn't find DSO to load: libreact_render_core.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.thrilld.app/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:34)
       at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:17)
       at com.facebook.react.bridge.Arguments.createMap(Arguments.java:159)
       at expo.modules.updates.statemachine.UpdatesStateContext.getWritableMap(UpdatesStateContext.kt:53)
       at expo.modules.updates.UpdatesController.sendUpdateStateChangeEventToBridge(UpdatesController.kt:561)
       at expo.modules.updates.statemachine.UpdatesStateMachine.sendChangeEventToJS(UpdatesStateMachine.kt:65)
       at expo.modules.updates.statemachine.UpdatesStateMachine.processEvent(UpdatesStateMachine.kt:47)
       at expo.modules.updates.UpdatesController$start$1.onRemoteCheckForUpdateStarted(UpdatesController.kt:285)
       at expo.modules.updates.loader.LoaderTask.launchRemoteUpdateInBackground$lambda$1(LoaderTask.kt:313)
       at expo.modules.updates.loader.LoaderTask.$r8$lambda$jwzCL9xjo0jbCNnExNO-hPCX6iI()
       at expo.modules.updates.loader.LoaderTask$$ExternalSyntheticLambda1.run(:6)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

me too I ++ Screen Shot 2023-09-21 at 9 51 22 AM

Having the same issue with the same specs

@jinkange
Copy link

jinkange commented Oct 3, 2023

me too

@idris1735
Copy link

why are they not answering, i am facing this issue too

@idris1735
Copy link

I fixed it. The method was newly built I've been writing all the configuration files, such as app.json, babel.config.js, eas,json, package.json, only the components I've written in the new project. And they installed all the modules in npmi. So it worked.

I don't understand what you mean please.

@DejavuDaniel
Copy link

how to fix this stupid issue wtf ?

@rossparachute
Copy link

rossparachute commented Oct 31, 2023

Same issue, successful build locally.

Crash on boot looking for libjscexecutor.so and expo-modules-core lib .so files.

The expo-modules-core stuff might be related to not being able to make use of the CMake scripts when building.

Possibly related to the missing libjsexecutor.so stuff too though. Feels like the gradle build is missing something.

P.S. There has been stuff added to the project build.gradle and app/build.gradle to pull in two third-party libs but otherwise the gradle is what's output by npx expo prebuild --clean. We also had to comment out the externalNativeBuild CMakeLists.txt block in the expo-modules-core build.gradle as it was killing builds, what's throwing the CMake build process off is unclear. Proven very hard to track down but it seems to have no reference to ReactAndroid despite the CMake directory args being set what seems to be correctly.

I'm surprised libjscexecutor.so is attempted to be loaded given hermes is the engine used. I've debugged both the debug and release gradle builds, that hermesEnabled flag in gradle.properties is definitely set to true and picked up in the app/build.gradle.

expo-env-info 1.0.5 environment info:
   System:
     OS: Windows 10 10.0.19045
   Binaries:
     Node: 18.0.0 - C:\Program Files\nodejs\node.EXE        
     Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
     npm: 9.5.1 - ~\AppData\Roaming\npm\npm.CMD
   IDEs:
     Android Studio: AI-223.8836.35.2231.10811636
   npmPackages:
     expo: 49.0.16 => 49.0.16 
     react: 18.2.0 => 18.2.0 
     react-native: 0.72.6 => 0.72.6 
   Expo Workflow: bare
  "dependencies": {
    "@mapbox/mapbox-gl-geocoder": "^5.0.1",
    "@react-native-community/datetimepicker": "7.2.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/drawer": "^6.6.2",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@reduxjs/toolkit": "^1.9.5",
    "@rnmapbox/maps": "^10.0.15",
    "axios": "^1.3.5",
    "camelize": "^1.0.1",
    "date-fns": "^2.29.3",
    "date-fns-tz": "^2.0.0",
    "expo": "49.0.16",
    "expo-crypto": "~12.4.1",
    "expo-device": "~5.4.0",
    "expo-image-picker": "~14.3.2",
    "expo-keep-awake": "~12.3.0",
    "expo-linear-gradient": "~12.3.0",
    "expo-location": "~16.1.0",
    "expo-notifications": "~0.20.1",
    "expo-random": "~13.2.0",
    "expo-secure-store": "~12.3.1",
    "expo-splash-screen": "~0.20.5",
    "expo-standard-web-crypto": "^1.5.0",
    "expo-status-bar": "~1.6.0",
    "expo-task-manager": "~11.3.0",
    "expo-updates": "~0.18.17",
    "mapbox-gl": "^2.14.1",
    "object-hash": "^3.0.0",
    "react": "18.2.0",
    "react-bootstrap": "^2.7.4",
    "react-native": "0.72.6",
    "react-native-dotenv": "^3.4.8",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-paper": "^5.7.0",
    "react-native-reanimated": "~3.3.0",
    "react-native-root-siblings": "^4.1.1",
    "react-native-root-toast": "^3.4.1",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-svg": "13.9.0",
    "react-native-webview": "13.2.2",
    "react-redux": "^8.0.5",
    "react-toastify": "^9.1.2",
    "redux": "^4.2.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-promise-middleware": "^6.1.3",
    "redux-saga": "^1.2.3",
    "redux-thunk": "^2.4.2",
    "reselect": "^4.1.8",
    "styled-components": "^5.3.9",
    "swr": "^2.1.3",
    "uuid": "^9.0.0"
  },

Project build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '33.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '33')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '33')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'
        frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "25.2.9519653"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:7.4.2')
        classpath('com.facebook.react:react-native-gradle-plugin')
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }

        maven {
            url = uri("https://maven.pkg.github.com/dojo-engineering/android-dojo-pay-sdk")
            credentials {
                username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
                password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
            }
        }

        maven {
            url  "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                username 'foo'
                password 'bar'
            }
        }
    }
}
// @generated begin @rnmapbox/maps-v2-maven - expo prebuild (DO NOT MODIFY) sync-32f1b7024bb5099f2805443b1960a3233ccde124

allprojects {
  repositories {
    maven {
      url 'https://api.mapbox.com/downloads/v2/releases/maven'
      authentication { basic(BasicAuthentication) }
      credentials {
        username = 'mapbox'
        password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
      }
    }
  }
}

// @generated end @rnmapbox/maps-v2-maven

Project app/build.gradle:

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()

/**
 * 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 {
    entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
    reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
    hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
    codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()

    // Use Expo CLI to bundle the app, this ensures the Metro config
    // works correctly with Expo projects.
    cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
    bundleCommand = "export:embed"

    /* 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")

    /* 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 = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]

    //
    //   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 = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()

/**
 * 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:+'

android {

}

android {
    packagingOptions {
        jniLibs {

            pickFirsts += [
                    'lib/x86/libc++_shared.so',
                    'lib/x86_64/libc++_shared.so',
                    'lib/arm64-v8a/libc++_shared.so',
                    'lib/armeabi-v7a/libc++_shared.so',
                    'lib/x86/libjsc.so',
                    'lib/x86_64/libjsc.so',
                    'lib/arm64-v8a/libjsc.so',
                    'lib/armeabi-v7a/libjsc.so',
                    'lib/x86/libjscexecutor.so',
                    'lib/x86_64/libjscexecutor.so',
                    'lib/arm64-v8a/libjscexecutor.so',
                    'lib/armeabi-v7a/libjscexecutor.so'
            ]
        }
    }

// @generated begin @rnmapbox/maps-libcpp - expo prebuild (DO NOT MODIFY) sync-e24830a5a3e854b398227dfe9630aabfaa1cadd1
// @generated end @rnmapbox/maps-libcpp


    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    buildFeatures {
        buildConfig = true
        prefab = false
    }

    defaultConfig {
        applicationId 'app.name'
        namespace 'app.name'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "0.0.1"

        buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    configurations {
        all*.exclude module: 'fbjni-java-only'
    }
}

// Apply static values from `gradle.properties` to the `android.packagingOptions`
// Accepts values in comma delimited lists, example:
// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
    // Split option: 'foo,bar' -> ['foo', 'bar']
    def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
    // Trim all elements in place.
    for (i in 0..<options.size()) options[i] = options[i].trim();
    // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
    options -= ""

    if (options.length > 0) {
        println "android.packagingOptions.$prop += $options ($options.length)"
        // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
        options.each {
            android.packagingOptions[prop] += it
        }
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
    def frescoVersion = rootProject.ext.frescoVersion

    // If your app supports Android versions before Ice Cream Sandwich (API level 14)
    if (isGifEnabled || isWebpEnabled) {
        implementation("com.facebook.fresco:fresco:${frescoVersion}")
        implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
    }

    if (isGifEnabled) {
        // For animated gif support
        implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
    }

    if (isWebpEnabled) {
        // For webp support
        implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
        if (isWebpAnimatedEnabled) {
            // Animated webp support
            implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
        }
    }

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android") {
            exclude group:'com.facebook.fbjni'
        }
    } else {
        implementation jscFlavor
    }
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)

Project gradle.properties:

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.182.0

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
deleteDebugFilesForVariant=false

# Enable GIF support in React Native images (~200 B increase)
expo.gif.enabled=true
# Enable webp support in React Native images (~85 KB increase)
expo.webp.enabled=true
# Enable animated webp support (~3.4 MB increase)
# Disabled by default because iOS doesn't support animated webp
expo.webp.animated=false

# Enable network inspector
EX_DEV_CLIENT_NETWORK_INSPECTOR=true

android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

expoRNMapboxMapsImpl=mapbox
MAPBOX_DOWNLOADS_TOKEN=foo

@Linuhusainnk
Copy link

my issue is with

libturbomodulejsijni.so

RN : 63.4

@aadityapaliwal94
Copy link

Facing this issue in React Native 0.69

couldn't find DSO to load: libjscexecutor.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.newput.tinyviewdev/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.newput.tinyviewdev-gHvNz_xnGV99FSzurdQs6Q==/lib/x86 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
Native lib dir: /data/app/com.newput.tinyviewdev-gHvNz_xnGV99FSzurdQs6Q==/lib/x86
result: 0

@rossparachute
Copy link

Downgrading to Expo v49.0.0 with React Native v0.72.6 fixed this issue for us.

@aadityapaliwal94
Copy link

@rossparachute I am not using expo. :(

@rossparachute
Copy link

Ah sorry, @aadityapaliwal94 - seems there's a few causes for this! Upgrading React Native to 72 might be worth trying.

Hope you can find a solution soon. :)

@Linuhusainnk
Copy link

Upgrading to upper version fixed for me

@aadityapaliwal94
Copy link

Thanks @rossparachute and @Linuhusainnk

Updating react native version at this point is too much work for me. But I am able to run it once updated on v0.69.7

Used this as ref - #35210

@rajspathak
Copy link

Dear Team,

I have been encountering the same issue over the past few days. Despite my efforts to implement various solutions, I have been unsuccessful in replicating the problem. I have thoroughly reviewed and attempted all possible solutions, but the issue persists.

To provide more context, could you please specify the nature of the problem you're experiencing, any error messages received, or any unexpected behavior encountered? Additionally, if there are specific details about the code or environment that could be relevant, please share them. Your detailed information will greatly assist in diagnosing and resolving the issue.

WhatsApp Image 2023-11-18 at 00 28 02_fd06cbdd

@Ozaoujal
Copy link

same issue here

@bartproo
Copy link

bartproo commented Dec 12, 2023

same issue here, react native version 0.72.6, expo: 49.0.15. This happened when I integrate with existing app. If I build the expo app from start then no problem

@pecabum
Copy link

pecabum commented Dec 13, 2023

It's somehow related to Proguard because today i got the issue when enabled it.

@rajitha-bandara
Copy link

I'm still having the same issue with RN 0.72.6 and expo 49.0

@komal1502
Copy link

Has anyone found a fix to it ? facing the same issue when the app is installed, it immediately crashes with the same error. I'm working on RN 0.72.6 and expo 49.0. Please tell how can i resolve this issue ?

@Svarto
Copy link

Svarto commented Jan 4, 2024

same issue, also RN 0.72.6 and expo 49.0

EDIT: My error was related to another error crashing the app as a function was called before it was initialized. Hard to debug but fixed this at least.

@ErikTromp
Copy link

Here too RN v0.72.4 and Expo 49.0.8

@GouthamJM
Copy link

same issue, also RN 0.72.6 and expo 49.0

@abhimangalmsrently
Copy link

abhimangalmsrently commented Jan 23, 2024

I had the same issue. For me I was having the following snippet
import xxx.xxx.BuildConfig; Class XYZ{ new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } }

I removed import xxx.xxx.BuildConfig and changed the classpath('com.android.tools.build:gradle:7.0.2') to classpath('com.android.tools.build:gradle:7.0.4')

Then the issue git fixed.
So, this is can happen with multiple reason. So we need to check each of them.

@macseem
Copy link

macseem commented Feb 22, 2024

why is this closed? error is still there
updating from RN 0.72.6 to 0.72.10 and updating SoLoader to 11.0 didn't help

@DejavuDaniel
Copy link

Dont use expo to build android apps , its much easier to debug and fix the errors , expo is good only with ios

@ErikTromp
Copy link

I am use EAS with expo ejected using prebuild which allows me to modify platform native code but nothing suggested here or on other places so far has worked.

@DejavuDaniel
Copy link

You are probably missing some dependencies

@SachinMS4
Copy link

SachinMS4 commented Jul 25, 2024

I am also facing this issue on React Native v0.66.3 when I update the Gradle plugin after updating compileSdkVersion to 34.

classpath('com.android.tools.build:gradle:7.0.3') => classpath('com.android.tools.build:gradle:7.1.2')

However, variant=debug works fine.

@HanggiAnggono
Copy link

I am also facing this issue on React Native v0.66.3 when I update the Gradle plugin after updating compileSdkVersion to 34.

classpath('com.android.tools.build:gradle:7.0.3') => classpath('com.android.tools.build:gradle:7.1.2')

However, variant=debug works fine.

this also happens to me, trying to update compileSdkVersion to 34 on react-native 0.66.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests