EDIT: It's worth noting I'm developing on Android right now
I am getting the __fbBatchedBridge
error on my ReactNative app. The issue is NOT a failure to connect to the packager (evidence thereof is below). The issue started when I installed a bunch of packages for testing, but even when I reverted, deleted node_modules
, and did npm install
it persists.
package.json
{
"name": "MyApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"log": "adb logcat *:S ReactNative:V ReactNativeJS:V"
},
"dependencies": {
"events": "^1.1.0",
"react-native": "^0.18.0",
"react-native-push-notification": "^1.0.2",
"react-native-scrollable-tab-view": "^0.3.5",
"react-native-webrtc": "^0.2.7",
"react-redux": "^4.4.0",
"redux": "^3.3.1",
"socket.io-client": "^1.4.4"
},
"devDependencies": {
"redux-devtools": "^3.1.1"
}
}
npm start results
[7:19:50 PM] <START> Building Dependency Graph
[7:19:50 PM] <START> Crawling File System
[7:19:50 PM] <START> Loading bundles layout
[7:19:50 PM] <END> Loading bundles layout (0ms)
React packager ready.
[7:19:53 PM] <START> request:/index.android.bundle?platform=android&dev=true
[7:19:53 PM] <START> find dependencies
[7:19:56 PM] <END> Crawling File System (5686ms)
[7:19:56 PM] <START> Building in-memory fs for JavaScript
[7:19:56 PM] <END> Building in-memory fs for JavaScript (346ms)
[7:19:56 PM] <START> Building in-memory fs for Assets
[7:19:56 PM] <END> Building in-memory fs for Assets (322ms)
[7:19:56 PM] <START> Building Haste Map
[7:19:56 PM] <START> Building (deprecated) Asset Map
[7:19:57 PM] <END> Building (deprecated) Asset Map (87ms)
[7:19:57 PM] <END> Building Haste Map (452ms)
[7:19:57 PM] <END> Building Dependency Graph (6811ms)
[7:19:57 PM] <END> find dependencies (4018ms)
[7:19:57 PM] <START> transform
transforming [========================================] 100% 549/549
[7:20:00 PM] <END> transform (3417ms)
[7:20:00 PM] <END> request:/index.android.bundle?platform=android&dev=true (7463ms)
As you can see, the packager is packaging and sending the bundle to Genymotion, which is then raising the error.
This problem is fixed in newer version of React Native. I would advice you to please upgrade your version to 0.22
.
However, If you're looking for temporary fix than in node_modules/react-native/packager/packager.sh
replace
if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
echo "Skipping bundling for Simulator platform"
exit 0;
fi
with
# if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
# echo "Skipping bundling for Simulator platform"
# exit 0;
# fi
At AppDelegate.m file, we will using :
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
instead of :
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
It work for me.
From terminal:
adb shell input keyevent 82
Genymotion opens dev menu, go to Dev Settings
Then: adb shell input text <your IPv4 adress>:8081
And finally:
adb reverse tcp:8081 tcp:8081
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.