React Native Environment Info:
System:
OS: macOS High Sierra 10.13.1
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 1.49 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.3.0 - ~/.nvm/versions/node/v11.3.0/bin/node
npm: 6.5.0 - ~/.nvm/versions/node/v11.3.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 14, 19, 22, 23, 24, 25, 26, 27, 28
Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3
System Images: android-19 | ARM EABI v7a, android-19 | Intel x86 Atom, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4720617
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.6.1 => 16.6.1
react-native: 0.57.6 => 0.57.6
Indexed unbundling:
Create a single file which is stripped down version of typical bundle. But app crashes on loading react view with this bundle.
File based unbundling
If i use this files based unbundling with code push will it work? or is there any way.
Create a build with indexed bundle and one with file based bundle app crashes with the above crash log.
Can you run react-native info and edit your issue to include these results under the Environment section?
If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.
It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.
The ":rewind: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.
Updating the rn version.
still having same issue.
we've faced the same issue
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 40.30 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 24.0.0, 25.0.1, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2
API Levels: 23, 24, 25, 26, 27, 28
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.1 => 0.57.1
npmGlobalPackages:
react-native-cli: 2.0.1
any fix or workaround?
Hey! Are there any updates?
Any updates on this?
@hramos Please help here, As your documentation says we can use ram-bundles now. I was earlier on react native 49 but now i am on latest version.
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.1
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 1.49 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.3.0 - ~/.nvm/versions/node/v11.3.0/bin/node
npm: 6.5.0 - ~/.nvm/versions/node/v11.3.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 14, 19, 22, 23, 24, 25, 26, 27, 28
Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3
System Images: android-19 | ARM EABI v7a, android-19 | Intel x86 Atom, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4720617
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.6.1 => 16.6.1
react-native: 0.57.6 => 0.57.6
Still I am getting the same issues please help me, as our release is totally dependent on it now.
Prompt Response will be solicited.
@shergin @javache @mkonicek @davidaurelio @nicklockwood @hramos @jeanlauliac
Guys, please help in this issue. it will be a great help
@vivek-walecha-657 please avoid tagging a lot of people, it's spammy and unlikely to expedite your issue.
@hramos Sure. Can anyone help here to get this issue resolved?
Can you check if this is still an issue on RN 0.59? The unbundle was changed to ram-bundle (and --indexed-unbundle to --indexed-ram-bundle). You can also find the docs on the topic helpful: https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
We'll close the issue, because it refers to the unmaintained version of React Native, but if you feel like there's still something wrong, please prepare a minimal reproduction using latest RN that we can download and inspect.
@thymikee, ram-bundle with --indexed-ram-bundle doesn't work with 0.59.2. I have created app (react-native init) and have modifyed build.gradle.
project.ext.react = [
entryFile: "index.js",
bundleCommand: "ram-bundle",
extraPackagerArgs: ["--indexed-ram-bundle"],
]
Error from logcat
FATAL EXCEPTION: mqt_js
Process: com.testram, PID: 5805
com.facebook.jni.UnknownCppException: Unknown
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
Can we reopen this? I can also verify that this still happens on Android in a brand new react native app v0.59.2. cc: @kelset
+1 I am having the same issue !
I have exactly the same issue as @kuznetsov-online
I am using a clean 0.59.3 react-native init project, only modifying the build.gradle
It's easy to reproduce like this.
I tried a bunch of stuff, running it in debug works tho only if I really want to use the release / prod build with the ram bundle it fails.
Also if I enable bundleInDebug: true, to also have the bundle in debug.
If I follow the docs and do
project.ext.react = [
entryFile: "index.js",
bundleCommand: "ram-bundle",
bundleConfig: "packager/config.js"
]
node process fails, so I have to use extraPackagerArgs: ["--indexed-ram-bundle"],
Edit: Tried it with 0.59.0 and 0.58.6 no dice, same error.
+1 same issue
With React Native 0.59.8 the app keeps crashing with RAM bundle on Android with the following error:
2019-05-09 11:58:06.684 2793-2856/? E/AndroidRuntime: FATAL EXCEPTION: mqt_js
Process: com.ramtestapp, PID: 2793
com.facebook.jni.CppException: getPropertyAsObject: property '__fbRequireBatchedBridge' is not an Object
no stack
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:193)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
It looks like it's trying to get __fbBatchedBridge which is undefined so it falls back to __fbRequireBatchedBridge here: https://github.com/facebook/react-native/blob/v0.59.8/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L285-L290
@zamotany did this work in 0.59.5? can you track the commit that broke it?
@thymikee We have found that RAM bundle generated by metro is invalid - it should be more than 1000 lines and it's missing most of the code. So I believe the metro team should investigate more.
Also it looks like https://github.com/facebook/react-native/blob/v0.59.8/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L285-L290 is called before startup code from RAM bundle is evaluated. Adding a throw new Error to startup code is not resulting in JS crash, but still com.facebook.jni.CppException: getPropertyAsObject: property '__fbRequireBatchedBridge' is not an Object
We did some more investigation and found that RAM bundles have been broken on Android for a long time, but are working in iOS. (Ironic, since low-end Android devices see a bigger improvement to TTI than iOS devices.) File RAM bundles do appear to work in Android, so there is that option.
If there's no intent to fix from Facebook, this problem should probably be noted in the documentation. Once that intent is confirmed, I'll prepare a PR to update the documentation.
@zamotany and I are trying to debug cpp code from ReactAndroid to find out what happens. We already managed to attach debugger and it stops on breakpoints but we are not able to see values of variables because of optimisation. We found that we can turn off optimisation by adding APP_OPTIM=debug in Application.mk or setting NDK_DEBUG=1 when running ndk-build, but it fails with either of those with a lot of errors in Folly, similar to:
/Users/piotrdrapich/projects/rnfromsource/node_modules/react-native/ReactAndroid/build/third-party-ndk/folly/folly/lang/Assume.h:43: error: undefined reference to 'folly::detail::assume_check(bool)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/piotrdrapich/projects/rnfromsource/node_modules/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/libfolly_json.so] Error 1
Do you have some insights or something how could we debug cpp code from ReactAndroid or ReactCommon?
After finally, getting debugging to work properly, we found that when using any bundle, let it be non-ram, FIle RAM bundle or Index RAM bundle, the CatalystInstanceImpl.java is always using loadScriptsFromAsset, which is calling CatalystInstanceImpl::jniLoadScriptFromAssets in C++. This method when checking if bundle is a RAM bundle, uses JniJSModulesUnbundle::isUnbundle which only check for js-modules/UNBUNDLE - file generated when building File RAM bundle. There is no other logic to handle Index RAM bundle, so it figures that the bundle is not RAM, cause there is no js-modules/UNBUNDLE file and tries to load as regular bundle and fails.
Interestingly CatalystInstanceImpl::jniLoadScriptFromFile does check if bundle is Indexed RAM bundle, but jniLoadScriptFromFile and loadScriptFromFile from CatalystInstanceImpl.java never gets called.
Does anyone know whether loadScriptFromFile not being called is a bug itself? Or should we add Index RAM bundle logic to jniLoadScriptFromAssets?
cc: @nparashuram @fkgozali
Closing, as #24967 landed on master.
@dratwas mind helping to port that to 0.59 as well? cc @kelset @grabbou
I've linked it in the 0.59.x release issue - I'll try to cherry pick and see what happens 🙈
Is there a status on this? I have the same problem as in #25455, and I can't manage to solve it. The section of my build.gradlelooks exactly like the one of @HazAT, and I'm on RN 0.59.10. Thanks.
With React Native
0.59.8the app keeps crashing with RAM bundle on Android with the following error:2019-05-09 11:58:06.684 2793-2856/? E/AndroidRuntime: FATAL EXCEPTION: mqt_js Process: com.ramtestapp, PID: 2793 com.facebook.jni.CppException: getPropertyAsObject: property '__fbRequireBatchedBridge' is not an Object no stack at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) at android.os.Looper.loop(Looper.java:193) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232) at java.lang.Thread.run(Thread.java:764)It looks like it's trying to get
__fbBatchedBridgewhich isundefinedso it falls back to__fbRequireBatchedBridgehere: https://github.com/facebook/react-native/blob/v0.59.8/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L285-L290
Do refer to #25859 , the workaround works.
Most helpful comment
After finally, getting debugging to work properly, we found that when using any bundle, let it be non-ram, FIle RAM bundle or Index RAM bundle, the
CatalystInstanceImpl.javais always usingloadScriptsFromAsset, which is callingCatalystInstanceImpl::jniLoadScriptFromAssetsin C++. This method when checking if bundle is a RAM bundle, usesJniJSModulesUnbundle::isUnbundlewhich only check forjs-modules/UNBUNDLE- file generated when building File RAM bundle. There is no other logic to handle Index RAM bundle, so it figures that the bundle is not RAM, cause there is nojs-modules/UNBUNDLEfile and tries to load as regular bundle and fails.Interestingly
CatalystInstanceImpl::jniLoadScriptFromFiledoes check if bundle is Indexed RAM bundle, butjniLoadScriptFromFileandloadScriptFromFilefromCatalystInstanceImpl.javanever gets called.Does anyone know whether
loadScriptFromFilenot being called is a bug itself? Or should we add Index RAM bundle logic tojniLoadScriptFromAssets?cc: @nparashuram @fkgozali