React-native: Couldn't get the native call queue: bridge configuration isn't available

Created on 3 May 2016  ยท  48Comments  ยท  Source: facebook/react-native

I'm unable to run the init app using the master.
I followed steps describe here : https://facebook.github.io/react-native/docs/android-building-from-source.html
I always get the same error:
Couldn't get the native call queue: bridge configuration isn't available
I'm on MacOS and try to run the android init app on the simulator (genymotion).
Note that I started the packager. I can see log requests.

Ran Commands Locked

Most helpful comment

I solved my problem using adb reverse tcp:8081 tcp:8081 before react-native run-android

All 48 comments

I meet the same problem after I upgrade my RN project from 0.24.1 to 0.25.1

java.lang.RuntimeException: Couldn't get the native call queue: bridge configuration isn't available. This shouldn't be possible. Congratulations.
                                                       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                       at android.os.Handler.handleCallback(Handler.java:733)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                       at android.os.Looper.loop(Looper.java:136)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
                                                       at java.lang.Thread.run(Thread.java:841)

Same here, I removed node_modules and installed again but nothing

I solve my problem .After I change package.json from 0.24.1 to 0.25.1 and npm install , I rebuild the android/app/build.gradle to refresh the react-native dependencies.Then it's normal to start the project and no crash again.

I solved my problem using adb reverse tcp:8081 tcp:8081 before react-native run-android

I'm on window and try with adb reverse tcp:8081 tcp:8081 (=>error: closed), package.json is default
but can't solve.

I'm seeing the same thing after doing

react-native init AwesomeProject
cd AwesomeProject
react-native run-android

I've tried @Davids89's fix, but it does not make difference.

In another window, try running

react-native start

Apparently the package server doesn't start. I don't really know why, yet...

Thank you @willfong. That did it for me together with adb reverse tcp:8081 tcp:8081.

same issue, the above fixes didnt resolve it for me. _edit_ deleted node_modules, android/.gradle and android/build and re-installed and now its working

thanks , adb reverse tcp:8081 tcp:8081 did for me.

Can't get this working.

I tried adb reverse tcp:8081 tcp:8081 - same error.

When I type "react-native start" I get this error:

[acfu@localhost AwesomeProject]$ react-native start
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Running packager on port 8081. โ”‚
โ”‚ โ”‚
โ”‚ Keep this packager running while developing on any JS projects. Feel โ”‚
โ”‚ free to close this tab and run your own packager instance if you โ”‚
โ”‚ prefer. โ”‚
โ”‚ โ”‚
โ”‚ https://github.com/facebook/react-native โ”‚
โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Looking for JS files in
/home/acfu/Documents/AwesomeProject

ERROR watch /home/acfu/Documents/AwesomeProject ENOSPC
{"code":"ENOSPC","errno":"ENOSPC","syscall":"watch /home/acfu/Documents/AwesomeProject","filename":"/home/acfu/Documents/AwesomeProject"}
Error: watch /home/acfu/Documents/AwesomeProject ENOSPC
at exports._errnoException (util.js:893:11)
at FSWatcher.start (fs.js:1313:19)
at Object.fs.watch (fs.js:1341:11)
at NodeWatcher.watchdir (/home/acfu/Documents/AwesomeProject/node_modules/sane/src/node_watcher.js:144:20)
at new NodeWatcher (/home/acfu/Documents/AwesomeProject/node_modules/sane/src/node_watcher.js:45:8)
at FileWatcher._createWatcher (/home/acfu/Documents/AwesomeProject/node_modules/node-haste/lib/FileWatcher/index.js:107:21)
at /home/acfu/Documents/AwesomeProject/node_modules/node-haste/lib/FileWatcher/index.js:54:20
at Array.map (native)
at new FileWatcher (/home/acfu/Documents/AwesomeProject/node_modules/node-haste/lib/FileWatcher/index.js:53:39)
at new Server (index.js:189:9)

See http://facebook.github.io/react-native/docs/troubleshooting.html

I fixed it by upgrading react to 15.0.2 with react-native 0.26.0-rc / master.
See the release notes for 0.26.0-rc https://github.com/facebook/react-native/releases/tag/v0.26.0-rc

Thanks! Now it works :]

Here is what I did:

Changed dependencies in package.json to:
"dependencies": {
"react": "^15.0.2",
"react-native": "^0.26.0-rc"
}
Executed npm i
Started the emulator.
Executed react-native run-android

Then the emulator said
react native android emulator could not connect to development server

Executed react-native start
Hit Reload JS Button in the App.

@facebook-github-bot answered

Closing this issue as @AndrewJack says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

I also have the same problem. I am integrating with Existing App. So the app runs, but when I try to load my React code. I get the same error.

I have tried to upgrade react and react-native to:
"react": "^15.0.2",
"react-native": "^0.26.0-rc"

And i start the react-packages with node node_modules/react-native/local-cli/cli.js start. The packages starts:

image

But the app still crashes. Any suggestions? I have been struggling with this for a while now.

Closing this issue is certainly a bit premature. There is no clear way how to prevent it and to me it looks clearly like a bug that costs many developers time. Please re-open to prevent duplicates from getting opened.

@facebook-github-bot reopen

Okay, reopening this issue.

Reopened: Have you tested with 0.26.0 stable?
If the problem still occurs, could you please provide a project reproducing the issue?

cc @Giszmo @skeie

couldn't get the native call queue:bridge configuration isn't available. this probably indicates there was an issue loading the js bundle,e.g. it wasn't packaged into the app or was malformed. check your logs('adb logcat') for more information

@appbeijing the message is much clearer now, with the logcat part.

E/ReactNativeJS( 7123): Error:
    undefined is not a function (evaluating 'babelHelpers.typeof(global)'), stack:

That's a different issue then โ€ฆ

Thanks for fixing the error message.

E:\react\workspace\myBeauty>adb logcat *:S ReactNative:V ReactNativeJS:V
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
E/ReactNativeJS(19837): Error: Requiring unknown module "ReactPerf".
If you are sure the module is there, try restarting the packager or running "npm install".

Same here.

After upgrading as the doc says :
npm install --save react-native@latest
react-native upgrade

Now I have :

  • for iOS: Command /bin/sh failed with exit code 1
  • for Android: Couldn't get the native call queue: bridge configuration isn't available

EDIT:
Thank you @logTom, I updated the dependencies "react" to "^15.0.2" and recompile and it works now.
Don't forget to update your config files if overwritten on upgrade (I had to update Info.plist for my fonts on iOS and re-manually-install ExtraDimensions for Android).

I'm new to React Native, I'm just going through the getting started section and this bug occurs with the empty autogenerated project from react-native init with the latest React Native (0.26.0). I can build and deploy (Java) Android apps from Android Studio but React Native apps fail to start. I tried running react-native start first as well as adb reverse tcp:8081 tcp:8081 but they don't make any difference. It does not work in the emulator nor in a device.

One thing I noticed is I get this message when executing react-native run-android:

:app:bundleDebugJsAndAssets SKIPPED

As well as a couple of warnings when generating the project:

$ react-native init TestProject
This will walk you through creating a new React Native project in /home/user/AndroidProjects/TestProject
Installing react-native package from npm...
Setting up new React Native app in /home/user/AndroidProjects/TestProject
[email protected] /home/user/AndroidProjects/TestProject
โ””โ”€โ”€ [email protected] 

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

Full error message is as follows:

Couldn't get the native call queue: bridge configuration isn't available. This probably indicates there was an issue loading the JS bundle, e.g. it wasn't packaged into the app or was malformed. Check your logs('adb logcat') for more information

run
NativeRunnable.java:-2

handleCallback
Handler.java:95

dispatchMessage
MessageQueueThreadHandler.java:31

loop
Looper.java:136

run
MessageQueueThreadImpl.java:187

run
Thread.java:841

If at this point I hit the Reload JS button I just get the "Could not connect to development server error", but the server is definitely running.

I missed the same problem. I ran the project on the genymotion. Becase I forgot open the WIFI. When I open that, it worked.

Thank you @willfong. That did it for me together

I created a new react-native project and added my java code to that, and then everything worked for me.

@tfl435918939 I'm also using Genymotion, that fixed my problem. Thank you

What I did:
1) I set my ip address and the debug port (8081) on the virtual device in Dev Settings >> Debug server host & port for device
2) I connected to the wifi network in the virtual device and reloaded the package

@skeie I know that will work for me too, but wan't to figure out how to fix it correctly in existing project.

I tried all of the above using RN 0.26.2 -- also deleted /node_modules/ and npm install. Deleted /android/build/ and /android/app/build directories. Still not working for this one project.

If I create a new project it works fine.

I updated to latest versions via package.json then npm update, and now get this error in emulator:
screen shot 2016-05-28 at 3 59 37 pm

  "dependencies": {
    "react": "^15.1.0",
    "react-native": "^0.27.0-rc2"
  },

I was having this problem. Using @saemie solution fixed mine. It is documented in the docs here: https://facebook.github.io/react-native/docs/running-on-device-android.html#configure-your-app-to-connect-to-the-local-dev-server-via-wi-fi

Wonder if that will solve the issue on emulator too? Docs are specific to running on h/w device.

Brand new setup, did everything in the Getting Started section and I have the very same issue than everyone else.
My package.json:
{ "name": "reactsample", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { "react": "^15.0.2", "react-native": "^0.26.2" } }

Guys, I've managed to solve this (and jump to the next error...) by installing watchman + settings the following cfg:
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches watchman shutdown-server
See here (https://github.com/facebook/react-native/issues/3199) for more.

I am now jumping to this: https://github.com/facebook/react-native/issues/7679

I was facing the same issue and that's how I ended up here. Here is how I fixed it.
The problem is that the app was trying to connect to the local server localhost:8081 which is not available in the phone.

Follow the below steps

  1. Start your development server in your machine. react-native start , this should start you server.
  2. Open your app in you mobile which is showing a red screen, don't worry about that.
  3. Type in this command in your machine - adb shell input keyevent 82
  4. Go to Dev Settings.
  5. Go to Debug server host for device.
  6. Type in your machine's IP address and the port of the local dev server. my case - 192.168.1.1:8081 and save.
  7. Type adb shell input keyevent 82 in command line and Reload JS

The red screen is gone now!

Thanks for the link @johnphillips1992

Same issue (on device) after upgrading from

  "react": "^0.14.8",
  "react-native": "^0.25.1",

to

"react": "^15.0.2",
"react-native": "^0.26.3",

I've tried everything listed so far, red screen persists.

I've noticed two things:

  1. if I hit 'RELOAD JS' enough times (sometimes after 2-3 reloads, often after ~10 times) app eventually loads. (and everything works fine)
  2. if I switch location to 'Location Off' it loads every time

@muthuspark Fix my problem.
In my ubuntu 14.04 I also update java to oracle jdk 8, reinstall Android sdk and update npm, then react-native init MyProject and then follow @muthuspark.

My team has the same problem does anyone know a possible work around ? I have tried everything on this list and nothing has worked out. I am considering creating a new rn project and then moving all the files in.

Ok, I solved my issue. It was totally unrelated to anything mentioned above, but as it raises the same exception ('Couldn't get the native call queue: bridge configuration isn't available') someone googling it might stumble on this thread and find it useful.

I have some native Java code for location updates (because navigator.geolocation doesn't work well in android yet, and setTimeout() doesn't work when app in background). the code that starts location updates was in the constructor, and when you get an update, it would dispatch an event.

    private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
        if (reactContext.hasActiveCatalystInstance()) {
            reactContext
                    .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                    .emit(eventName, params);
        } else {
            Log.i(TAG, "Waiting for CatalystInstance...");
        }
    }

I'm not sure what hasActiveCatalystInstance() does, as I didn't write this module, but the end result was that because it starts updating in object construction time, way before the bundle even loads, the native code would try to call js code before the bridge was setup.

Moving the code that starts location updates from the constructor to a .startUpdates() method and calling it from js solved the issue.

Maybe we should have a different error message for this types of errors?

@quatrix Can you please elaborate on what you did here? "Moving the code that starts location updates from the constructor to a .startUpdates() method and calling it from js solved the issue."
I'm looking at the same code from from this react-native-push-notifications package here: https://github.com/zo0r/react-native-push-notification/blob/2ee0c696f8eb108a678658aaeb1e61370d9a87bd/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java#L59

@Streemo In more general terms, say you have class Foo (a native module which you include getPackages())

@Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new Foo(),
        );
    }

and it has a sendEvent method you use to communicate with your JS part:

private void sendEvent(String eventName, @Nullable WritableMap params) {
        this.context
                .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(eventName, params);
    }

And Foo constructor calls sendEvent.

This is a race condition as the constructor is called before the JS part done setting up and the message queue might not be available yet, so you're trying to sendEvent where there's no message queue yet and it explodes.

In my case, the constructor would immediately start listening to location events and relaying them via sendEvent to JS, and sometimes it was before message queue was done setting up.

To resolve this, I added something like StartSendingLocationUpdates() to Foo, and I'm calling StartSendingLocationUpdates from JS code, which means message queue must be already up otherwise I couldn't have called this method.

Hope this was a better explanation. and Please someone correct me if I'm wrong I draw these conclusions from observations, not actually reading the code.

Could you please show your startSendingEvent method and what your JS code
which calls the startSendingEvent method looks like? I would appreciate it,
thanks! And your reasoning sounds right. For some reason, this is happening
on the first start of the app, but not on subsequent starts.

On Aug 28, 2016 5:22 PM, "quatrix" [email protected] wrote:

@Streemo https://github.com/Streemo In more general terms, say you have
class Foo (a native module which you include getPackages())

@Override
protected List getPackages() {
return Arrays.asList(
new Foo(),
);
}

and it has a sendEvent method you use to communicate with your JS part:

private void sendEvent(String eventName, @Nullable WritableMap params) {
this.context
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}

And Foo constructor calls sendEvent.

This is a race condition as the constructor is called before the JS part
done setting up and the message queue might not be available yet, so you're
trying to sendEvent where there's no message queue yet and it explodes.

In my case, the constructor would immediately start listening to location
events and relaying them via sendEvent to JS, and sometimes it was before
message queue was done setting up.

To resolve this, I added something like StartSendingLocationUpdates() to
Foo, and I'm calling StartSendingLocationUpdates from JS code, which means
message queue must be already up otherwise I couldn't have called this
method.

Hope this was a better explanation. and Please someone correct me if I'm
wrong I draw these conclusions from observations, not actually reading the
code.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/7336#issuecomment-243000187,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIbgsnJkOKoo-F4pw281vmhlYYhsB8mVks5qkfwwgaJpZM4IVxex
.

It solved my issue when I replaced the localhost with Ip address in dev menu in the app because there was no server running on my localhost, it was unable to connect my development server.

Looks like this has turned into a misc-troubleshooting thread, with most troubles shooted. I'm going to close this issue but if people have specific cases of this they should feel free to open a new issue that focuses on that.

Im integrating react native within exist android app as

$ npm init
$ npm install --save react react-native
$ curl -o .flowconfig https://raw.githubusercontent.com/facebook/react-native/master/.flowconfig

I tried both as npm start and react-native start with adb reverse tcp:8081 tcp:8081 as well.
but Im getting same problem as below details and attached log file.

04-13 10:50:34.793 22421-22661/com.example.mbaghela1.demo4 E/AndroidRuntime: FATAL EXCEPTION: mqt_js Process: com.example.mbaghela1.demo4, PID: 22421 java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24) at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:161) at com.facebook.react.cxxbridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:465) at com.facebook.react.cxxbridge.CatalystInstanceImpl.access$400(CatalystInstanceImpl.java:51) at com.facebook.react.cxxbridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:481) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:33) at android.os.Looper.loop(Looper.java:148) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) at java.lang.Thread.run(Thread.java:818) Caused by: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:746) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:148)ย  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)ย  at java.lang.Thread.run(Thread.java:818)ย  Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)ย  at android.os.Handler.handleCallback(Handler.java:746)ย  at android.os.Handler.dispatchMessage(Handler.java:95)ย  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)ย  at android.os.Looper.loop(Looper.java:148)ย  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)ย  at java.lang.Thread.run(Thread.java:818)ย 

2017-04-13T05_20_28_065Z-debug.txt

Was this page helpful?
0 / 5 - 0 ratings