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

Android signed release build cannot find DSO to load - Unsatisfied Link Error #23902

Closed
thomasarogers opened this issue Mar 13, 2019 · 17 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@thomasarogers
Copy link

Bug Description

When running a signed release build on a physical device (Google Pixel 2) the application fails to open and crashes immediately with the error message below. Debug build runs without error.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: Error: Cannot load /data/app/com.singletrack-oLMiw4nVqqKxhbcbq5quCg==/lib/arm/librealmreact.so

image

From the error message it is looking for the librealmreact.so binary in /lib/arm/ but when I analyse the APK the librealmreact.so is located in /lib/armeabi-v7a/ but I do not know why it is searching on the wrong path.

image

Gradle config

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js",
inputExcludes: ["ios/", "Tests/", "bundle_out/", "default.realm", "default.realm.lock", "default.realm.management/"],
nodeExecutableAndArgs: hasProperty("NODE_PATH")?[NODE_PATH]:["node"]
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
    applicationId "com.singletrack"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "0.7"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }

    enableSeparateBuildPerCPUArchitecture = false
}


dexOptions {
    preDexLibraries false
    javaMaxHeapSize "8g"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

}

dependencies {
implementation project(':realm')
implementation project(':react-native-sentry')
implementation project(':react-native-push-notification')ns')
implementation project(':react-native-svg')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation 'com.facebook.react:react-native:+'
// From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

Expected Behavior

Application should open and run without error

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz
Memory: 679.33 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.15.0 - /usr/local/opt/node@8/bin/node
npm: 6.4.1 - /usr/local/opt/node@8/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 26, 27, 28
Build Tools: 23.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-26 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: ^0.57.1 => 0.57.8
npmGlobalPackages:
create-react-native-app: 2.0.2

@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@miguelslemos
Copy link

#23764

@dulmandakh
Copy link
Contributor

Hello there 👋 this issue has been reported for an old version of React Native. Ideally we'd like everyone to be using 0.59 (see the awesome changes it brought) but we know updating can be a pain. We are going to close this issue because it's from a version before 0.57, which is really old.

But please, if it's actually still an issue with 0.59 please comment below and we can reopen it. Even better, please send us a pull request with a fix 😊

@thomasarogers
Copy link
Author

Fixed in 0.59 thanks!

@cve0x0
Copy link

cve0x0 commented May 11, 2019

Still having the bug with RN 0.59.8.

My package.json file is

{
  "name": "TestApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "native-base": "^2.11.0",
    "prop-types": "^15.7.2",
    "react": "16.8.3",
    "react-native": "0.59.8",
    "react-native-gesture-handler": "^1.0.15",
    "react-native-maps": "^0.24.2",
    "react-native-screens": "^1.0.0-alpha.22",
    "react-native-vector-icons": "^6.3.0",
    "react-navigation": "^3.3.0",
    "realm": "^2.27.0-rc.3"
  },
  "devDependencies": {
    "@babel/core": "^7.3.3",
    "@babel/runtime": "^7.3.1",
    "@types/react": "^16.8.3",
    "@types/react-native": "^0.57.36",
    "@types/react-native-vector-icons": "^4.6.4",
    "@types/react-navigation": "^3.0.3",
    "babel-plugin-module-resolver": "^3.2.0",
    "metro-react-native-babel-preset": "^0.51.1",
    "react-native-typescript-transformer": "^1.2.11",
    "typescript": "^3.3.3"
  }
}

Exception:

2019-05-11 14:44:00.413 30681-30733/com.testapp E/SoLoader: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: "/data/data/com.testapp/lib-main/librealmreact.so" is 32-bit instead of 64-bit
2019-05-11 14:44:00.415 30681-30733/com.testapp E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.testapp, PID: 30681
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: "/data/data/com.testapp/lib-main/librealmreact.so" is 32-bit instead of 64-bit
        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 io.realm.react.RealmReactModule.<clinit>(RealmReactModule.java:56)
        at io.realm.react.RealmReactPackage.createNativeModules(RealmReactPackage.java:31)
        at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)
        at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:41)
        at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1212)
        at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1182)
        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1120)
        at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:123)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:943)
        at java.lang.Thread.run(Thread.java:764)```

@Meninblack007
Copy link

Meninblack007 commented May 30, 2019

I am also facing this issue on React Native 0.59.8.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.myntra.blinkwearable/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
FATAL EXCEPTION: create_react_context
Process: com.myntra.blinkwearable, PID: 28389
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.myntra.blinkwearable/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
	at com.facebook.soloader.SoLoader.b(SoLoader.java:738)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:591)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:529)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:484)
	at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:31)
	at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19)
	at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:25)
	at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944)
	at java.lang.Thread.run(Thread.java:818)

is there any fix/workaround?

@viveksoneja28
Copy link

viveksoneja28 commented Jun 1, 2019

Hi, Even we are facing the same issue. It works fine with Standalone Apks (generated from bundle). But starts crashing with multi-apk install. Kindly help to resolve this.

Tried with RN Version 0.53.3, 0.58.6 and 0.59.0.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:11)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:6)
        at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:2)
        at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:1)
        at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create(JSCJavaScriptExecutorFactory.java:1)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:9)
        at java.lang.Thread.run(Thread.java:764)

@anuskaleem
Copy link

anuskaleem commented Jul 20, 2019

Still getting same error on android signed apk, debug apk works normally. Using react-native 0.60.4
Package.json:

{
  "name": "react_native_squirrel",
  "version": "5.3.4",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.5.1",
    "@react-native-community/geolocation": "^1.4.2",
    "@react-native-community/netinfo": "4.1.0",
    "big-integer": "1.6.25",
    "moment": "2.24.0",
    "react": "16.8.6",
    "react-native": "0.60.4",
    "react-native-calendars": "1.115.0",
    "react-native-device-info": "^2.2.2",
    "react-native-firebase": "5.5.5",
    "react-native-fs": "^2.13.3",
    "react-native-icon-badge": "1.1.3",
    "react-native-marquee": "0.3.2",
    "react-native-modal-datetime-picker": "7.4.0",
    "react-native-paper": "2.15.2",
    "react-native-permissions": "^1.2.0",
    "react-native-picker-select": "6.1.0",
    "react-native-router-flux": "3.43.0",
    "react-native-simple-radio-button": "2.6.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "6.3.1",
    "react-navigation": "1.0.0-beta.11",
    "react-redux": "5.0.6",
    "realm": "2.29.1",
    "redux": "3.7.2",
    "redux-thunk": "2.2.0"
  },
  "devDependencies": {
    "@babel/core": "7.5.0",
    "@babel/runtime": "7.5.0",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.1.0",
    "jest": "24.1.0",
    "metro": "^0.55.0",
    "metro-react-native-babel-preset": "0.54.1",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

Stack Trace:

--------- beginning of crash
07-20 20:40:15.166 32024-32052/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.workstream.squirrel, PID: 32024
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: Error: Cannot load /data/app/com.workstream.squirrel-1/lib/arm/librealmreact.so
        at com.facebook.soloader.SoLoader.a()
        at com.facebook.soloader.SoLoader.a()
        at com.facebook.soloader.SoLoader.a()
        at com.facebook.soloader.SoLoader.a()
        at io.realm.react.RealmReactModule.<clinit>()
        at io.realm.react.a.a()
        at d.a.m.u.a()
        at d.a.m.f.a()
        at d.a.m.p.a()
        at d.a.m.p.a()
        at d.a.m.p.a()
        at d.a.m.p.a()
        at d.a.m.p$e.run()
        at java.lang.Thread.run(Thread.java:818)

Does anyone have any idea?

@uncledent
Copy link

If you use realm, update it to the latest version, which is 64bit compatible

@shaktimoyal
Copy link

I am also facing this issue on React Native 0.59.8.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.myntra.blinkwearable/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
FATAL EXCEPTION: create_react_context
Process: com.myntra.blinkwearable, PID: 28389
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.myntra.blinkwearable/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
	at com.facebook.soloader.SoLoader.b(SoLoader.java:738)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:591)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:529)
	at com.facebook.soloader.SoLoader.a(SoLoader.java:484)
	at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:31)
	at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19)
	at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:25)
	at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944)
	at java.lang.Thread.run(Thread.java:818)

is there any fix/workaround?

Did u get any fix ?

@shukerullah
Copy link

@shaktimoyal Did you find the solution?

@shaktimoyal
Copy link

@shaktimoyal Did you find the solution?

Working on it . Not able to find yet.

@anuskaleem
Copy link

@shukerullah @shaktimoyal
what's your realm lib version? Have you updated the library? Also have you included 64 bit architecture in your app level gradle config file?

@shaktimoyal
Copy link

@shukerullah @shaktimoyal
what's your realm lib version? Have you updated the library? Also have you included 64 bit architecture in your app level gradle config file?

I am not using realm.

Simply using react native 0.59.0 version and crash report at Firebase test lab says following :

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.aasaanjobs.employee.aasaanjobsemployee/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
FATAL EXCEPTION: create_react_context
Process: com.aasaanjobs.employee.aasaanjobsemployee, PID: 11804
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.aasaanjobs.employee.aasaanjobsemployee/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
at com.facebook.soloader.SoLoader.b(SoLoader.java:738)
at com.facebook.soloader.SoLoader.a(SoLoader.java:591)
at com.facebook.soloader.SoLoader.a(SoLoader.java:529)
at com.facebook.soloader.SoLoader.a(SoLoader.java:484)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:31)
at com.facebook.react.bridge.NativeMap.(NativeMap.java:19)
at com.facebook.react.jscexecutor.a.create(JSCExecutorFactory.java:25)
at com.facebook.react.l$5.run(ReactInstanceManager.java:944)
at java.lang.Thread.run(Thread.java:764)

@anuskaleem
Copy link

@shukerullah @shaktimoyal
what's your realm lib version? Have you updated the library? Also have you included 64 bit architecture in your app level gradle config file?

I am not using realm.

Simply using react native 0.59.0 version and crash report at Firebase test lab says following :

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.aasaanjobs.employee.aasaanjobsemployee/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
FATAL EXCEPTION: create_react_context
Process: com.aasaanjobs.employee.aasaanjobsemployee, PID: 11804
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.aasaanjobs.employee.aasaanjobsemployee/lib-4/libc++_shared.so" is 32-bit instead of 64-bit
at com.facebook.soloader.SoLoader.b(SoLoader.java:738)
at com.facebook.soloader.SoLoader.a(SoLoader.java:591)
at com.facebook.soloader.SoLoader.a(SoLoader.java:529)
at com.facebook.soloader.SoLoader.a(SoLoader.java:484)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:31)
at com.facebook.react.bridge.NativeMap.(NativeMap.java:19)
at com.facebook.react.jscexecutor.a.create(JSCExecutorFactory.java:25)
at com.facebook.react.l$5.run(ReactInstanceManager.java:944)
at java.lang.Thread.run(Thread.java:764)

have u included 64 bit architecture in your gradle configurations?

@shaktimoyal
Copy link

shaktimoyal commented Sep 16, 2019

Yes, i have added.
have a look at my gradle file

apply plugin: "com.android.application"
apply plugin: "io.fabric"

import com.android.build.OutputFile

/**

  • The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
  • and bundleReleaseJsAndAssets).
  • These basically call react-native bundle with the correct arguments during the Android build
  • cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
  • bundle directly from the development server. Below you can see all the possible configurations
  • and their defaults. If you decide to add a configuration block, make sure to add it before the
  • apply from: "../../node_modules/react-native/react.gradle" line.
  • project.ext.react = [
  • // the name of the generated asset file containing your JS bundle
  • bundleAssetName: "index.android.bundle",
  • // the entry file for bundle generation
  • entryFile: "index.android.js",
  • // whether to bundle JS and assets in debug mode
  • bundleInDebug: false,
  • // whether to bundle JS and assets in release mode
  • bundleInRelease: true,
  • // whether to bundle JS and assets in another build variant (if configured).
  • // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  • // The configuration property can be in the following formats
  • // "bundleIn${productFlavor}${buildType}"
  • // "bundleIn${buildType}"
  • // bundleInFreeDebug: true,
  • // bundleInPaidRelease: true,
  • // bundleInBeta: true,
  • // whether to disable dev mode in custom build variants (by default only disabled in release)
  • // for example: to disable dev mode in the staging build type (if configured)
  • devDisabledInStaging: true,
  • // The configuration property can be in the following formats
  • // "devDisabledIn${productFlavor}${buildType}"
  • // "devDisabledIn${buildType}"
  • // the root of your project, i.e. where "package.json" lives
  • root: "../../",
  • // where to put the JS bundle asset in debug mode
  • jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  • // where to put the JS bundle asset in release mode
  • jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require("./image.png")), in debug mode
  • resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require("./image.png")), in release mode
  • resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  • // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  • // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  • // date; if you have any other folders that you want to ignore for performance reasons (gradle
  • // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  • // for example, you might want to remove it from here.
  • inputExcludes: ["android/", "ios/"],
  • // override which node gets called and with what additional arguments
  • nodeExecutableAndArgs: ["node"],
  • // supply additional arguments to the packager
  • extraPackagerArgs: []
  • ]
    */

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

/**

  • Set this to true to create two separate APKs instead of one:
    • An APK that only works on ARM devices
    • An APK that only works on x86 devices
  • The advantage is the size of the APK is reduced by about 4MB.
  • Upload all the APKs to the Play Store and people will download
  • the correct one based on the CPU architecture of their device.
    */
    def enableSeparateBuildPerCPUArchitecture = true

/**

  • Run Proguard to shrink the Java bytecode in release builds.
    */
    def enableProguardInReleaseBuilds = true

android {
dexOptions {
javaMaxHeapSize "12g"
}
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "fgregregregergergerg"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 167
versionName "3.4.39"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}

}

signingConfigs {
release {
storeFile file("candidate.jks")
storePassword "paradise"
keyAlias "newemployee"
keyPassword "paradise"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
debug {
buildConfigField "String", "CODEPUSH_KEY", '""'
minifyEnabled true
useProguard true
shrinkResources true
buildConfigField("String", "CLEVERTAP_ACCOUNT_ID", '"4r-4r-4r-K84Z"')
buildConfigField("String", "CLEVERTAP_TOKEN", '"TEST-4r-a44"')
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
releaseStaging {

  buildConfigField "String", "CODEPUSH_KEY", '"4rr4r4r4r4r4r"'
  // Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
  // Add the following line if not already there
  matchingFallbacks = ['release']
  minifyEnabled true
  useProguard true
  shrinkResources true
  signingConfig signingConfigs.release
  buildConfigField("String", "CLEVERTAP_ACCOUNT_ID", '"TEST-4r-4r-K84Z"')
  buildConfigField("String", "CLEVERTAP_TOKEN", '"TEST-4r-a44"')
  proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
release {
  buildConfigField "String", "CODEPUSH_KEY", '"4r34r-JF4bHfHyPkg6Hi4"'
  minifyEnabled true
  useProguard true
  shrinkResources true
  signingConfig signingConfigs.release
  buildConfigField("String", "CLEVERTAP_ACCOUNT_ID", '"rf4r43r43r34r"')
  buildConfigField("String", "CLEVERTAP_TOKEN", '"4r34r"')
  proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}

}
// applicationVariants are e.g. debug, release
// applicationVariants.all { variant ->
// variant.outputs.each { output ->
// // For each separate APK per architecture, set a unique version code as described here:
// // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
// def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
// def abi = output.getFilter(OutputFile.ABI)
// if (abi != null) {
// // null for the universal-debug, universal-release variants
// output.versionCodeOverride =
// versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
// }
// }
// }
}

dependencies {

implementation "com.facebook.react:react-native:+"  // From node_modules
implementation project(':react-native-code-push')
implementation project(':react-native-google-places')
implementation project(':react-native-share')
implementation project(':react-native-webview')
implementation project(':react-native-firebase')
implementation project(':clevertap-react-native')
implementation project(':rn-fetch-blob')
implementation project(':react-native-document-picker')
implementation project(':react-native-image-picker')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-snackbar')
implementation project(':react-native-svg')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:multidex:1.0.3'
implementation "com.google.firebase:firebase-appindexing:17.1.0"
implementation "com.google.firebase:firebase-messaging:17.3.3"
implementation 'com.google.firebase:firebase-analytics:16.0.6'
implementation "com.google.firebase:firebase-core:16.0.6"
implementation 'com.clevertap.android:clevertap-android-sdk:3.4.2'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true
}
implementation ("com.android.support:appcompat-v7:28.0.0"){
    exclude module: "support-v4"
}
implementation ("com.android.support:design:28.0.0"){
    exclude module: "support-v4"
}

// https://stackoverflow.com/questions/49112190/error-program-type-already-present-android-support-design-widget-coordinator
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into "libs"
}

apply plugin: "com.google.gms.google-services"

// this code has been added due to an build error occured because of codepush and google play services 4.2.0 version
// on emore solution to this issue is adding following line
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

@shukerullah
Copy link

TLDR
Finally I manage to fixcouldn't find DSO to load: libreactnativejni.so issue by updating react native from v0.57.0 to v0.59.1

I was trying to create separate build per CPU Architecture and app-arm64-v8a-release.apk was crashing on my Samsung note 9. However, app-armeabi-v7a-release.apk was working fine.

package.json file

...
...
...
"dependencies": {
  ...
  ...
  ...
  "react": "16.8.3",
  "react-native": "0.59.1"
  ...
  ...
  ...
}
...
...
...

android/app/build.gradle file

...
...
...
defaultConfig {
    ...
    ...
    ...
//    ndk {
//        abiFilters "armeabi-v7a", "x86"
//    }
    ...
    ...
    ...
}
...
...
...
def enableSeparateBuildPerCPUArchitecture = true
...
...
...
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
...
...
...
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}
...
...
...

After release build I can see now all the missing .so libs under andriod/app/build/intermediates/stripDebugSymbol/release/0/lib, earlier libreactnativejni.so and other libs were missing inside stripDebugSymbol/release/0/lib/arm64-v8a

Screen Shot 2019-09-16 at 7 56 18 PM

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests