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] release PR app insta crashes after upgrading react native from 0.67.5 to 0.69.10 #16139

Closed
siddarthkay opened this issue Jun 2, 2023 · 8 comments
Assignees

Comments

@siddarthkay
Copy link
Contributor

siddarthkay commented Jun 2, 2023

Bug Report

The Android release app from this PR : #16016 insta crashes.

We've seen this behaviour in the last upgrade as well
ref : #15486 (comment)

Problem

After connecting logcat the stack trace is below :

2023-06-02 08:32:34.264 32471-32471 SoLoader               
pid-32471                            
E  couldn't find DSO to load: libjscexecutor.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/im.status.ethereum.pr/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = 
/data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64
result: 0

2023-06-02 08:32:34.266 32471-32471 SoLoader 
pid-32471
E  couldn't find DSO to load: libhermes-executor-debug.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/im.status.ethereum.pr/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = 
/data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64
result: 0

This log below seems to be the root causes


2023-06-02 08:32:34.267 32471-32471 SoLoader
pid-32471
E  couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/im.status.ethereum.pr/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = 
/data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64
result: 0
2023-06-02 08:32:34.267 32471-32471 AndroidRuntime 
pid-32471
E  FATAL EXCEPTION: main
Process: im.status.ethereum.pr, PID: 32471
ava.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/im.status.ethereum.pr/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = 
/data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~FHkFRTBNK5ZxslLIXKdQqA==/im.status.ethereum.pr-pXglUHfjfa4emKUPty0Ybw==/lib/arm64
result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:30)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:394)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:344)
at com.reactnativenavigation.react.NavigationReactNativeHost.createReactInstanceManager
(NavigationReactNativeHost.java:58)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
at com.reactnativenavigation.react.ReactGateway.<init>(ReactGateway.java:20)
at com.reactnativenavigation.NavigationApplication.createReactGateway(NavigationApplication.java:40)
at com.reactnativenavigation.NavigationApplication.onCreate(NavigationApplication.java:27)
at im.status.ethereum.MainApplication.onCreate(MainApplication.java:78)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6771)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2129)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2023-06-02 08:32:34.268  1703-4625 
ActivityManager
pid-1703
E  App crashed on incremental package im.status.ethereum.pr which is 100% loaded.
2023-06-02 08:32:34.270  1703-4625  
ActivityTaskManager
pid-1703
W    Force finishing activity im.status.ethereum.pr/im.status.ethereum.MainActivity
2023-06-02 08:32:34.277  1703-1786  
ActivityManager
pid-1703                             
I  Showing crash dialog for package im.status.ethereum.pr u0

Additional Information

  • Operating System: Android
@siddarthkay siddarthkay added the bug label Jun 2, 2023
@siddarthkay siddarthkay self-assigned this Jun 2, 2023
@siddarthkay siddarthkay changed the title Android release PR app insta crashes after upgrading react native from 0.67.5 to 0.69.10 [Android] release PR app insta crashes after upgrading react native from 0.67.5 to 0.69.10 Jun 2, 2023
@siddarthkay
Copy link
Contributor Author

The fatal error which causes the crash seems to be originating at :
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Jun 2, 2023

@jakubgs : yes the error is the same but the solution outlined in that stackoveflow post and what we had done for the last upgrade introduce newer problems.
I'm trying to narrow down the problem and figure it out.
Will post stack traces and further investigations over here 👍🏻

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Jun 2, 2023

Adding this in android/app/build.gradle fixes the missing libhermes-executor-release.so error :

 project.ext.react = [
     enableHermes: !disableHermes,
     /* Disable 'The first definition was here.' warnings */
     hermesFlagsRelease: ["-w"],
+   /* FIXME: Workaround for crash caused by missing libhermes-executor-release.so.
+    * https://github.com/facebook/react-native/issues/32928 */
+   deleteDebugFilesForVariant: { false },
+   enableVmCleanup: false,
     bundleInPr: true,
     inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]
]

android {
dependencies {
      implementation fileTree(dir: "libs", include: ["*.jar"])
      implementation "com.facebook.react:react-native:+"  // From node_modules

+    implementation 'com.facebook.soloader:soloader:0.10.3+'
      implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
      implementation "androidx.core:core-splashscreen:1.0.0"

However, the app now infinitely hangs on the loading screen.

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Jun 2, 2023

The stacktrace in logcat now is this :

2023-06-02 15:35:14.060 25134-25215 
AndroidRuntime 
pid-25134
E  FATAL EXCEPTION: create_react_context
Process: im.status.ethereum.pr, PID: 25134
java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro 
(run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:248)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:277)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1404)
at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:136)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1108)
at java.lang.Thread.run(Thread.java:1012)

2023-06-02 15:35:14.071  1703-4654  
CoreBackPreview         
pid-1703                             
D  Window{f0e6069 u0 im.status.ethereum.pr/im.status.ethereum.MainActivity}: Setting back callback 
OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@f1a91ab, mPriority=0}
2023-06-02 15:35:14.375 25134-25134 
AndroidRuntime
pid-25134
E  FATAL EXCEPTION: main
Process: im.status.ethereum.pr, PID: 25134
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view 
hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9865)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1981)
at android.view.View.requestLayout(View.java:26304)
at android.view.View.requestLayout(View.java:26304)
at android.view.View.requestLayout(View.java:26304)
at android.view.View.requestLayout(View.java:26304)
at android.view.View.requestLayout(View.java:26304)
at android.widget.ScrollView.requestLayout(ScrollView.java:1671)
at android.view.View.requestLayout(View.java:26304)
at android.view.View.requestLayout(View.java:26304)
at android.widget.TextView.checkForRelayout(TextView.java:10091)
at android.widget.TextView.setText(TextView.java:6633)
at android.widget.TextView.setText(TextView.java:6454)
at android.widget.TextView.setText(TextView.java:6406)
at androidx.emoji2.viewsintegration.EmojiInputFilter$InitCallbackImpl.onInitialized(EmojiInputFilter.java:122)
at androidx.emoji2.text.EmojiCompat$ListenerDispatcher.run(EmojiCompat.java:1398)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Seems to be something wrong with either packaging or the jsbundleof PR builds.
Debug builds are working fine.
investigating further...

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Jun 2, 2023

this error is not new : https://stackoverflow.com/questions/72564710/react-native-crash-release-build-fatal-exception-create-react-context
I'll manually try downgrading gradlePlugin to 7.2.2 to verify this approach, we are currently on gradlePlugin version 7.3.0

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Jun 2, 2023

The [Android] react-native template for 0.69.10 uses gradle version 7.3.3

ref : https://github.com/facebook/react-native/blob/0.69-stable/template/android/gradle/wrapper/gradle-wrapper.properties#L3

and they use gradlePlugin version 7.1.1
ref : https://github.com/facebook/react-native/blob/0.69-stable/template/android/build.gradle#L25

probably best to stick to what they use over there.

also sometimes confusing that gradle and android gradle plugin versions are two different things 🥲

@siddarthkay
Copy link
Contributor Author

Fixed with

downgrading gradle plugin version here : nix/pkgs/aapt2/default.nix

pname = "aapt2";
  # Warning: This must be the same as gradlePluginVersion android/gradle.properties
-  version = "7.3.0-8691043";
+  version = "7.2.2-7984345";

  pkgPath = "com/android/tools/build/aapt2";
  repoUrl = "https://dl.google.com/dl/android/maven2";

    jar = fetchurl {
      url = "${repoUrl}/${pkgPath}/${version}/${filenames.jar}";
      sha256 = getAttr platform {
-        linux = "sha256-AP75/vGPx4cOZ7K8w60FhZptB/836mGAdIJ2+gCtOVc=";
-        osx = "sha256-Kg400fBovA3RlRpdnAPZXnPBliXFq5df+OpfhiAkvUc=";
+       linux = "sha256-BKtK5f7lxp0YdQU4AFGL933vjEAykQ1RiKpDwfc32oI=";
+       osx = "sha256-OORgWnGQS0GwqZrSg8sFQb4FM23hrYHwmarcYd8EO/0=";
      };
    };
    sha = fetchurl {
      url = "${repoUrl}/${pkgPath}/${version}/${filenames.jar}.sha1";
      sha256 = getAttr platform {
-        linux = "sha256-908Oq40eqHlu4KtlgJQIxyUu2IOyrtErjVc+MH5JM5E=";
-        osx = "sha256-hQQVMnqzaNd2v57uxWIzea21MlAuGur01T6fpcWD1fc=";
+       linux = "sha256-4F4REWQLj8hdnh1tIwRVgdWJjUBhvvINP56nIscwePA=";
+       osx = "sha256-n0jFUphzlFnNacolbXoNmNHs/hXfktVpYRlJ1JW9ukU=";
      };
    };
    pom = fetchurl {
      url = "${repoUrl}/${pkgPath}/${version}/${filenames.pom}";
-      sha256 = "sha256-HVQS9Dt7vvFN/MLr7I103KTbWQw3i/eCMUL+lNDFt6Y=";
+      sha256 = "sha256-XWEn9Zvxv0hgYU2yUSlZ4OiguZy1bz+Gh0wRrm4d9GQ=";
    };
  };

and here android/gradle.properties

buildToolsVersion=31.0.0
supportLibVersion=28.0.0
# This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix
- gradlePluginVersion=7.3.0
+ gradlePluginVersion=7.2.2
kotlinPluginVersion=1.6.20

android.useAndroidX=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants