Reputation: 808
When I run app in debug mode, it works fine, but when i install release mode it crashes immediately after start. I didn't find a fix yet.
Currently I am using Samsung J6 for the app.
Here are the logs by adb logcat *:E
:
03-30 14:03:08.718 32503 32556 E log : error java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
03-30 14:03:08.720 32503 32556 E SoLoader: couldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
03-30 14:03:08.721 32503 32556 E AndroidRuntime: FATAL EXCEPTION: create_react_context
03-30 14:03:08.721 32503 32556 E AndroidRuntime: Process: com.mindola, PID: 32503
03-30 14:03:08.721 32503 32556 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.SoLoader.b(Unknown Source:368)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:106)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:108)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.SoLoader.a(Unknown Source:1)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.l.a(Unknown Source:0)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.soloader.a.a.a(Unknown Source:10)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.jni.HybridData.<clinit>(Unknown Source:2)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.react.bridge.WritableNativeMap.initHybrid(Native Method)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.react.bridge.WritableNativeMap.<init>(Unknown Source:0)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at com.facebook.react.jscexecutor.a.create(Unknown Source:2)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at c.b.m.H.run(Unknown Source:58)
03-30 14:03:08.721 32503 32556 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
03-30 14:03:08.850 2956 3031 E Netd : getNetworkForDns: getNetId from enterpriseCtrl is netid 0
03-30 14:03:08.917 3297 3324 E WindowManager: RemoteException occurs on reporting focusChanged, w=Window{a61296f u0 com.mindola/com.mindola.MainActivity}
03-30 14:03:08.917 3297 3324 E WindowManager: android.os.DeadObjectException
03-30 14:03:08.917 3297 3324 E WindowManager: at android.os.BinderProxy.transactNative(Native Method)
03-30 14:03:08.917 3297 3324 E WindowManager: at android.os.BinderProxy.transact(Binder.java:1145)
03-30 14:03:08.917 3297 3324 E WindowManager: at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:500)
03-30 14:03:08.917 3297 3324 E WindowManager: at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3966)
03-30 14:03:08.917 3297 3324 E WindowManager: at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5497)
03-30 14:03:08.917 3297 3324 E WindowManager: at android.os.Handler.dispatchMessage(Handler.java:106)
03-30 14:03:08.917 3297 3324 E WindowManager: at android.os.Looper.loop(Looper.java:214)
03-30 14:03:08.917 3297 3324 E WindowManager: at android.os.HandlerThread.run(HandlerThread.java:65)
03-30 14:03:08.917 3297 3324 E WindowManager: at com.android.server.ServiceThread.run(ServiceThread.java:44)
03-30 14:03:08.930 32579 32579 E Zygote : isWhitelistProcess - Process is Whitelisted
03-30 14:03:08.933 32579 32579 E Zygote : accessInfo : 1
03-30 14:03:08.950 2956 3031 E FrameworkListener: read() failed (Connection reset by peer)
03-30 14:03:08.952 32579 32579 E android.dqagen: Not starting debugger since process cannot load the jdwp agent.
03-30 14:03:08.957 32590 32590 E Zygote : isWhitelistProcess - Process is Whitelisted
03-30 14:03:08.960 32590 32590 E Zygote : accessInfo : 1
03-30 14:03:08.962 3297 15116 E WindowManager: win=Window{a61296f u0 com.mindola/com.mindola.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:888 com.android.server.wm.AppWindowToken.destroySurfaces:869 com.android.server.wm.WindowState.onExitAnimationDone:5460 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:2422 com.android.server.wm.AppWindowToken.setVisibility:552
03-30 14:03:08.969 32590 32590 E oid.sm.provide: Not starting debugger since process cannot load the jdwp agent.
03-30 14:03:09.026 8108 8129 E SDHMS:SDHMS_UTIL_IO: e = /sys/class/input_booster/touchkey/time (Permission denied)
03-30 14:03:09.026 8108 8129 E SDHMS:SDHMS_UTIL_IO: e = /sys/class/input_booster/touchkey/time (Permission denied)
03-30 14:03:09.033 24346 24363 E PBSessionCacheImpl: sessionId[107076425850360534] not persisted.
03-30 14:03:09.062 3297 4215 E WindowManager: win=Window{60cb2a2 u0 Splash Screen com.mindola EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:888 com.android.server.wm.AppWindowToken.destroySurfaces:869 com.android.server.wm.WindowState.onExitAnimationDone:5460 com.android.server.wm.WindowStateAnimator.onAnimationFinished:319 com.android.server.wm.WindowState.onAnimationFinished:5882 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:100
03-30 14:03:09.394 21699 30661 E WakeLock: GCM_HB_ALARM release without a matched acquire!
Here is my android/build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
classpath("com.google.gms:google-services:4.2.0")
classpath("io.fabric.tools:gradle:1.28.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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()
maven { url 'https://jitpack.io' }
}
}
Here is my app/build.gradle
:
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
crashlytics {
enableNdk true
}
def useIntlJsc = false
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.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
/**
* The preferred build flavor of JavaScriptCore.
*
* 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:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.mindola"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 13
versionName "1.3"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
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:
// https://developer.android.com/studio/build/configure-apk-splits.html
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
}
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.android.gms:play-services-ads:18.3.0'
compile 'com.android.support:multidex:1.0.3'
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
if (useIntlJsc) {
implementation 'org.webkit:android-jsc-intl:+'
} else {
implementation 'org.webkit:android-jsc:+'
}
}
// 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 from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
// icons
project.ext.vectoricons = [
iconFontNames: [ 'FontAwesome5_Regular.ttf', 'FontAwesome5_Solid.ttf', 'FontAwesome.ttf' ] // Name of the font files you want to copy
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
In Firebase Crashlytics, i get this issue:
???
com.facebook.soloader.SoLoader.b
[Stack Trace]
Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
and
???
com.facebook.soloader.SoLoader.b
[Stack Trace]
Fatal Exception: java.lang.UnsatisfiedLinkError
couldn't find DSO to load: libhermes.so
I tried a few workarounds already after searching through similar questions, but none of them worked for me.
Upvotes: 8
Views: 10703
Reputation: 4122
The problem is commit with ProGuard rule for new DoNotStrip
java annotation has not been added to release branch.
More precise rule below. You should add this to android/app/proguard-rules.pro
as workaround:
-keep,allowobfuscation @interface com.facebook.jni.annotations.DoNotStrip
-keep @com.facebook.jni.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.jni.annotations.DoNotStrip *;
}
This should be fixed in next version and then this rule can be removed. You can vote here to add this commit to new minor release (but please do not comment to prevent noise).
UPDATED: Fixed in 0.62.1 so simply upgrade react-native package.
Upvotes: 2
Reputation: 2451
You're using ProGuard so you need to add the following rule to android/app/proguard-rules.pro
:
-keep class com.facebook.jni.** { *; }
This is mentioned in Breaking change of v0.62.0 changelog. https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#breaking
Upvotes: 23