Here are the steps to integrate experimented JavaScriptCore. Hopefully this could solve the JSC crash issue on RN 0.59.
yarn add 'jsc-android@next'
- Modify build.gradle files.
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 67980c5..0bc0510 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -135,9 +135,16 @@ android {
}
}
}
+
+ packagingOptions {
+ pickFirst '**/libjsc.so'
+ }
}
dependencies {
+ // Make sure to put android-jsc at the the first
+ implementation "org.webkit:android-jsc:r241213"
+
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
diff --git a/android/build.gradle b/android/build.gradle
index c6e7c7c..bd847fa 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -29,5 +29,9 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
+ maven {
+ // Local Maven repo containing AARs with JSC library built for Android
+ url "$rootDir/../node_modules/jsc-android/dist"
+ }
}
}
- Open a terminal shell to execute.
adb logcat | grep JavaScriptCore.Version
This step is to double confirm if you pick the right JSC version. As gradle's packagingOptions.pickFirst is not reliable to pick expected library.
-
react-native run-android
or gradle rebuild. -
The previous adb logcat result should be somehow like
05-17 21:09:07.352 14710 16259 D JavaScriptCore.Version: 241213.9000.0
The version should be 241213.9000.0 -
Check if crash happens.
Please feedbeck to me if these experimented versions fix the crash issue or not. On the other hand, the overall performance & TTI (App launch Time-To-Interact) is also meaningful to me. I want some real world feedback if there are impact to turn off JIT.
Please provide the backtrace to me.
wget https://registry.npmjs.org/jsc-android/-/jsc-android-241213.2.0.tgz
tar xf jsc-android-241213.2.0.tgz
unzip package/dist/org/webkit/android-jsc/r241213/android-jsc-r241213.aar
adb logcat -c
adb logcat | ndk-stack -sym jni/arm64-v8a/libjsc.so
Could not find org.webkit:android-jsc:r241213.