Android反应本机无法获得批量桥接

时间:2016-08-25 05:30:06

标签: android react-native

我试图运行我的第一个反应原生项目但是收到错误

"无法获得批量桥接,请确保您的包裹正确捆绑并且#34;

请帮我修理一下 - 使用的是Windows机器

4 个答案:

答案 0 :(得分:12)

我有同样的问题。请按照以下步骤在项目文件夹中进行解决:

react-native start

这可能需要一段时间。输出将如下所示:

Scanning 581 folders for symlinks in /home/shantanu/react-native/AwesomeProject/node_modules (5ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  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/shantanu/react-native/AwesomeProject 

[10/3/2016, 12:49:34 PM] <START> Building Dependency Graph
[10/3/2016, 12:49:34 PM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

[10/3/2016, 12:49:47 PM] <END>   Crawling File System (12440ms)
[10/3/2016, 12:49:47 PM] <START> Building in-memory fs for JavaScript
[10/3/2016, 12:49:47 PM] <END>   Building in-memory fs for JavaScript (123ms)
[10/3/2016, 12:49:47 PM] <START> Building in-memory fs for Assets
[10/3/2016, 12:49:47 PM] <END>   Building in-memory fs for Assets (90ms)
[10/3/2016, 12:49:47 PM] <START> Building Haste Map
[10/3/2016, 12:49:47 PM] <START> Building (deprecated) Asset Map
[10/3/2016, 12:49:47 PM] <END>   Building (deprecated) Asset Map (38ms)
[10/3/2016, 12:49:47 PM] <END>   Building Haste Map (773ms)
[10/3/2016, 12:49:47 PM] <END>   Building Dependency Graph (13551ms)
^[[B


[10/3/2016, 12:50:35 PM] <START> Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"}
[10/3/2016, 12:50:35 PM] <START> Finding dependencies
transformed 636/636 (100%)
[10/3/2016, 12:50:45 PM] <END>   Finding dependencies (9503ms)
[10/3/2016, 12:50:48 PM] <END>   Requesting bundle: {"url":"/index.android.bundle?platform=android&dev=true&hot=false&minify=false"} (13130ms)

一旦结束,请执行以下操作:

react-native run-android

答案 1 :(得分:5)

我在跟踪Getting Started tutorial并使用Visual Studio Emulator for Android时在Windows机器上遇到了同样的问题。

在我的情况下,我发现它失败了,因为它在构建应用程序时找不到adb,所以我通过将Android SDK Platform Tools文件夹添加到我的PATH来解决它。检查你有它! :)

答案 2 :(得分:0)

如果人们仍在寻找解决方案。 (请注意这适用于安装了Android 5.0或更高版本的设备)

This link clearly explains how to run in device.

要在设备上安装和启动应用程序,您需要运行以下adb命令(连接到开发计算机上运行的开发服务器)

$ adb reverse tcp:8081 tcp:8081

对于Mac用户: -

1. Go to Library/Android/sdk/platform-tools
2. ./adb reverse tcp:8081 tcp:8081

对于Windows用户: -

1. Go to C:\Users\<username>\AppData\Local\Android\sdk\platform-tools
2. adb reverse tcp:8081 tcp:8081

答案 3 :(得分:0)

我有同样的问题 -
什么对我有用:
 1.在Android设备中打开应用程序  2.摇动(重新加载)
 3.然后,在菜单上单击开发设置
 4.然后单击调试服务器主机&amp;设备端口
 5.输入计算机的IP,然后输入端口(通常为8081)。例如192.168.0.3:8081
 6. RELOAD 。瞧!它奏效了。