Closed leolusoli closed 2 years ago
@leolusoli am facing the same issue also but I am on RN0.67.4 it works fine on ios but the app crash after bundle install with same crash
Fatal Exception: com.facebook.react.common.c TypeError: Cannot read property 'split' of undefined, js engine: hermes, stack: anonymous@738:218 h@2:1585 d@2:1028 o@2:496 anonymous@731:127 h@2:1585 d@2:1028 o@2:496 anonymous@730:117 h@2:1585 d@2:1028 o@2:496 anonymous@677:150 h@2:1585 d@2:1028 o@2:496 anonymous@6:67 h@2:1585 d@2:958 o@2:496 global@5163:3
if you find any fixes please let me know
@leolusoli am facing the same issue also but I am on RN0.67.4 it works fine on ios but the app crash after bundle install with same crash
Fatal Exception: com.facebook.react.common.c TypeError: Cannot read property 'split' of undefined, js engine: hermes, stack: anonymous@738:218 h@2:1585 d@2:1028 o@2:496 anonymous@731:127 h@2:1585 d@2:1028 o@2:496 anonymous@730:117 h@2:1585 d@2:1028 o@2:496 anonymous@677:150 h@2:1585 d@2:1028 o@2:496 anonymous@6:67 h@2:1585 d@2:958 o@2:496 global@5163:3
if you find any fixes please let me know
What a "beautiful" news. I was wondering if I have something wrong in my project. This confirm that is not only my issue. Thanks a lot.
Please consider to get a look to it. Is not possible to use your library with this strange behaviour.
@FadiAboMsalam Incredible! I found it.
I turn off Hermes in Android and the crash become like this:
undefined is not an object (evaluating 'o(a[1]).NativeModules.SourceCode.scriptURL.split("://")[1].split')
So, I searched this stuff on web and I found this issue inside the repo. So I start to investigating in Reactotron (set up made by another team). I found those lines inside a configuration js code:
const { scriptURL } = NativeModules.SourceCode; const [scriptHostname] = scriptURL.split('://')[1].split(':')
So I change this code to the following
const [scriptHostname] = scriptURL?.split('://')[1]?.split(':') ?? 'localhost';
and CodePush start working even in Android.
PS: My 2 cent please.... was a tough one π
@leolusoli thank man you are a Life saver it was indeed my issue as well ! appreciate that bro your 2 cents are ready man π
@FadiAboMsalam Incredible! I found it.
I turn off Hermes in Android and the crash become like this:
undefined is not an object (evaluating 'o(a[1]).NativeModules.SourceCode.scriptURL.split("://")[1].split')
So, I searched this stuff on web and I found this issue inside the repo. So I start to investigating in Reactotron (set up made by another team). I found those lines inside a configuration js code:
const { scriptURL } = NativeModules.SourceCode; const [scriptHostname] = scriptURL.split('://')[1].split(':')
So I change this code to the following
const [scriptHostname] = scriptURL?.split('://')[1]?.split(':') ?? 'localhost';
and CodePush start working even in Android.
PS: My 2 cent please.... was a tough one π
Where can you know line (const [scriptHostname] = scriptURL?.split('://')[1]?.split(':') ?? 'localhost') fix in project?
Hey @leolusoli could you please let us know where is this line is in the project?
It still happen in 2024 react-native: 0.72.4 and code-push 8.2.2
I tried to remove everything related to reactotron but id didn't resolve the issue
Update: It works when I run it in debug mode
@FadiAboMsalam Incredible! I found it.
I turn off Hermes in Android and the crash become like this:
undefined is not an object (evaluating 'o(a[1]).NativeModules.SourceCode.scriptURL.split("://")[1].split')
So, I searched this stuff on web and I found this issue inside the repo. So I start to investigating in Reactotron (set up made by another team). I found those lines inside a configuration js code:
const { scriptURL } = NativeModules.SourceCode; const [scriptHostname] = scriptURL.split('://')[1].split(':')
So I change this code to the following
const [scriptHostname] = scriptURL?.split('://')[1]?.split(':') ?? 'localhost';
and CodePush start working even in Android.
PS: My 2 cent please.... was a tough one π
Thank you very much, your comment led me to the solution. In my case, I added a conditional to load the ReactotronConfig only in the development environment.
if (__DEV__) {
import('./config/ReactotronConfig');
}
Hi all, I'm trying to integrate the library inside a react-native 0.65.1 project (classical architecture from the template). The set-up goes well and iOS work perfectly. The problem I'm facing: after code-push download the bundle and plan the install, the Android app crash after installing the bundle with the ugly error:
TypeError: Cannot read property 'split' of undefined - Hermes engine
.Steps to Reproduce
assembleRelease
a version and install it inside the emulator for test the behaviourExpected Behavior
If iOS works correctly, I'm expecting that even Android works fine.
Actual Behavior
The Android crash after install the new bundle. If I retry to re-open the app, the application rollback the previous correct bundle.
Reproducible Demo
Another point of interest is that I also facing the:
[CodePush] Unable to get the hash of the binary's bundled resources - "codepush.gradle" may have not been added to the build definition.
problem. The app don't crash for this cause, but the message appears in thelogcat
. I already tried every suggestions found inside the issues for the repo regarding this warning but nothing works.I follow the classic set-up for react-native >= 0.60.
Don't esitate to contact me if you want more informations.
Environment