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] Crash On Startup Using New Arch + Hermes #34237

Closed
Kesmek opened this issue Jul 21, 2022 · 3 comments
Closed

[Android] Crash On Startup Using New Arch + Hermes #34237

Kesmek opened this issue Jul 21, 2022 · 3 comments
Labels
Needs: Triage 🔍 Platform: Android Android applications. Platform: Linux Building on Linux. Resolution: Duplicate Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@Kesmek
Copy link

Kesmek commented Jul 21, 2022

Description

When creating a fresh react native project from the template using npx react-native init test --template react-native-template-typescript, and changing the appropriate flags in android/app/build.gradle to enable hermes and in android/gradle.properties to enable the new arch, the app crashes on startup. It builds fine but on startup it crashes with these errors from adb:

07-21 12:42:57.766 21292 21292 E SoLoader: couldn't find DSO to load: libjscexecutor.so
07-21 12:42:57.766 21292 21292 E SoLoader:      SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.fabrictest/lib-main flags = 1]
07-21 12:42:57.766 21292 21292 E SoLoader:      SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~ul_lgralUfnyZ42Uxxpc4A==/com.fabrictest-Jq3mxwJAF96KnxdAWSAlxA==/lib/arm64 flags = 0]
07-21 12:42:57.766 21292 21292 E SoLoader:      SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
07-21 12:42:57.766 21292 21292 E SoLoader:      SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
07-21 12:42:57.766 21292 21292 E SoLoader:      Native lib dir: /data/app/~~ul_lgralUfnyZ42Uxxpc4A==/com.fabrictest-Jq3mxwJAF96KnxdAWSAlxA==/lib/arm64
07-21 12:42:57.766 21292 21292 E SoLoader:  result: 0
07-21 12:42:57.920 21292 21292 E unknown:ReactRootView: Unable to update root layout specs for ReactRootView: no rootViewTag set yet
07-21 12:42:58.289  2744 21351 E CastSocket: [TcpProberDeviceController-1] Failed to shutdown the output stream socket: tpt@a70e7cc.
07-21 12:42:58.289  2744 21351 E CastSocket: java.nio.channels.ClosedChannelException
07-21 12:42:58.289  2744 21351 E CastSocket:    at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:842)
07-21 12:42:58.289  2744 21351 E CastSocket:    at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:424)
07-21 12:42:58.289  2744 21351 E CastSocket:    at tor.l(:com.google.android.gms@222615044@22.26.15 (190400-461192076):4)
07-21 12:42:58.289  2744 21351 E CastSocket:    at tox.c(:com.google.android.gms@222615044@22.26.15 (190400-461192076):46)
07-21 12:42:58.289  2744 21351 E CastSocket:    at tow.run(:com.google.android.gms@222615044@22.26.15 (190400-461192076):2)
07-21 12:42:58.289  2744 21351 E CastSocket:    at java.lang.Thread.run(Thread.java:920)
07-21 12:42:58.290  2744 21199 E TcpProberDeviceController: [TcpProberDeviceController-1] onSocketConnectionFailed. Error: 2
07-21 12:42:59.438  2174  2950 E bt_btm  : system/bt/main/bte_logmsg.cc:191 LogMsg: BTM_BleObserve Observe Already Active
07-21 12:43:00.454 21292 21353 I ReactNativeJS: Running "fabricTest" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
07-21 12:43:00.720 21292 21292 E AndroidRuntime: Error reporting crash
07-21 12:43:00.720 21292 21292 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 320734176 byte allocation with 25165824 free bytes and 251MB until OOM, target footprint 30041136, growth limit 268435456
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.util.Arrays.copyOf(Arrays.java:3257)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.StringBuilder.append(StringBuilder.java:137)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.Throwable.toString(Throwable.java:493)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.String.valueOf(String.java:2924)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.io.PrintWriter.println(PrintWriter.java:754)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.Throwable$WrappedPrintWriter.println(Throwable.java:778)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.Throwable.printStackTrace(Throwable.java:667)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.Throwable.printStackTrace(Throwable.java:735)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at android.app.ApplicationErrorReport$CrashInfo.<init>(ApplicationErrorReport.java:354)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at android.app.ApplicationErrorReport$ParcelableCrashInfo.<init>(ApplicationErrorReport.java:484)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:157)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
07-21 12:43:00.720 21292 21292 E AndroidRuntime:        at java.lang.Thread.dispatchUncaughtException(Thread.java:2200)

Version

0.69.2

Output of npx react-native info

System:
    OS: Linux 5.18 undefined
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 17.64 GB / 31.27 GB
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.6.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.14.0 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: AI-212.5712.43.2112.8609683
  Languages:
    Java: 18.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.2 => 0.69.2 
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Init a new project with npx react-native init test --template react-native-template-typescript.
  2. Set enableHermes: true, in android/app/build.gradle.
  3. Set newArchEnabled=true in android/gradle.properties.
  4. Run yarn install; yarn android.
  5. App will crash on startup.

Snack, code example, screenshot, or link to a repository

Follow the reproduction steps to initialize a fresh project that will crash as mentioned above.

@Kesmek Kesmek added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Jul 21, 2022
@react-native-bot react-native-bot added the Platform: Linux Building on Linux. label Jul 21, 2022
@Kesmek Kesmek changed the title [Andriod] Crash On Startup Using New Arch + Hermes [Android] Crash On Startup Using New Arch + Hermes Jul 21, 2022
@react-native-bot react-native-bot added the Platform: Android Android applications. label Jul 21, 2022
@kelset
Copy link
Contributor

kelset commented Jul 22, 2022

👋 @Kesmek - I just tried to follow your repro steps but it doesn't crash for me:
Screenshot 2022-07-22 at 15 07 06

(I'm on macos)

That said, the issue here is probably your version of Java: per your info output, it looks like you have Java 18 installed; but we currently recommend folks use Java 11 (see https://reactnative.dev/docs/next/environment-setup).

We already have an issue about support for Java 18: #34103 and it has been addressed via these PRs:

So I'm going to close this, but let me know if there's something else going wrong here :)

@ahmadzraiq

This comment was marked as off-topic.

@Kesmek
Copy link
Author

Kesmek commented Jul 22, 2022

@ahmadzraiq I scanned through the error log you posted and it seems different than mine, which was a duplicate anyway. I suggest you create a new issue and follow the guidelines so that the react native team can help you more easily.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Platform: Android Android applications. Platform: Linux Building on Linux. Resolution: Duplicate Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

5 participants