Home > Enterprise >  App is being crashed instantly after build : java.lang.UnsatisfiedLinkError: couldn't find DSO
App is being crashed instantly after build : java.lang.UnsatisfiedLinkError: couldn't find DSO

Time:11-10

I was using RN V0.63.3 until this build failures happenings. I change my version to 0.63.5 and build done successfully. Now my application is being crashed instantly after build in development mode.

ERROR log :

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libturbomodulejsijni.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/user/0/com.zcarpet/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = ...

I upgraded my gradle version from 3.5.2 to 3.5.3 and tried these fixes :

  1. I used this code in \Android\build.gradle :
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:0.63.5" 
        }
    }
  1. Add below code in \Android\build.gridle :
    project.ext.react = [
        enableHermes: false,  // clean and rebuild if changing
        deleteDebugFilesForVariant: { false }
    ]
  1. many other fixes that could not help...

my project configurations :

    buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        if (useIntlJsc) {
            implementation 'org.webkit:android-jsc-intl: '
        } else {
            implementation 'org.webkit:android-jsc: '
        }
    }
    }

    allprojects {
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:0.63.5" 
        }
    }
    repositories {
        google()
        jcenter()
        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")
        }

        maven { url 'https://s3.amazonaws.com/repo.commonsware.com' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
        maven { url 'https://www.jitpack.io' }
        maven { url "https://maven.google.com" }
        
        google()
        maven { url 'https://www.jitpack.io' }
    }
    // Workaround for https://issuetracker.google.com/117900475
    // Remove when upgrading to AGP 3.4 or higher.
    configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
        config.resolutionStrategy.eachDependency { details ->
            details.useVersion("3.5.0-alpha03-5252756")
        }
    }
    }

CodePudding user response:

Please follow below steps and check

  1. Revert back all the changes you have made after that (downgrade gradle, react-native, java & everything as like before)
  2. Delete node_modules
  3. Delete build folders (android/build & android/app/build)
  4. Recheck the package.json if the react-native version is as which was worked before (in your case 0.63.3)
  5. Run npm install or yarn to install packages
  6. Clean (remove gradle cache like mentioned here : https://stackoverflow.com/a/30450020/10657559) and rebuild the app by adding the below changes to your android/build.gradle file

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())


buildscript {
     // ...
}
    
    
allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:"   REACT_NATIVE_VERSION
          }
    }
    // ...  
}

Ref: Fix and updates on Android build failures happening since Nov 4th 2022 #35210

CodePudding user response:

Finally I restored my November first backup, just added below code and it worked.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())


buildscript {
     // ...
}
    
    
allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:"   REACT_NATIVE_VERSION
          }
    }
    // ...  
}
  • Related