New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android error “Could not get BatchedBridge, make sure your bundle is packaged properly” on start of app #9336

Closed
Zygro opened this Issue Aug 10, 2016 · 77 comments

Comments

Projects
None yet
@Zygro

Zygro commented Aug 10, 2016

Solution

Run the following:

react-native run-android
react-native start --reset-cache

Description

After creating a project and not changing a single file, I tried to test it on my 4.4.2. device. I got this red screen right on start of the app and after dismissing it, only white screen was shown instead of welcome message that was supposed to be there.

screenshot_2016-08-10-11-45-29

I also got this error on 5.1.1, but the project worked fine on 6.1.1.
Android emulator (for 4.4.2) was also able to display the messages without this redscreen

Edit: On Stack Overflow, user tbo has posted an answer with a workaround. It does work, however it's not ideal as it takes more time http://stackoverflow.com/questions/38870710/error-could-not-get-batchedbridge-make-sure-your-bundle-is-packaged-properly/38874952#38874952

@jacobp100

This comment has been minimized.

Show comment
Hide comment
@jacobp100

jacobp100 Aug 10, 2016

Contributor

I get a similar error when trying to run an iOS app using a local build (no dev server): _fbBatchedBridge is undefined. The documentation on running on the device seems to be out of date too.

Contributor

jacobp100 commented Aug 10, 2016

I get a similar error when trying to run an iOS app using a local build (no dev server): _fbBatchedBridge is undefined. The documentation on running on the device seems to be out of date too.

@krtr

This comment has been minimized.

Show comment
Hide comment
@krtr

krtr Aug 10, 2016

Sometimes I got this error when I start clean app (bundle was never downloaded) In most cases there is error in connection between phone and computer.
Checking:

  • if adb reverse proxy is set up
  • if packager fucked up
  • if server adress is good (dev settings)

does a thing
(solution in SO does work because you upload prebacked apk with bundle inside but idk if watch works for you)

krtr commented Aug 10, 2016

Sometimes I got this error when I start clean app (bundle was never downloaded) In most cases there is error in connection between phone and computer.
Checking:

  • if adb reverse proxy is set up
  • if packager fucked up
  • if server adress is good (dev settings)

does a thing
(solution in SO does work because you upload prebacked apk with bundle inside but idk if watch works for you)

@brkr

This comment has been minimized.

Show comment
Hide comment
@brkr

brkr Aug 11, 2016

I got same error both android device and emulator

brkr commented Aug 11, 2016

I got same error both android device and emulator

@fisherman818

This comment has been minimized.

Show comment
Hide comment
@fisherman818

fisherman818 Aug 13, 2016

@T0toro facing the same error, but the info at the link doesn't help me

@T0toro facing the same error, but the info at the link doesn't help me

@stoffern

This comment has been minimized.

Show comment
Hide comment
@stoffern

stoffern Aug 13, 2016

react-native run-android
react-native start --reset-cache
react-native run-android
react-native start --reset-cache
@fisherman818

This comment has been minimized.

Show comment
Hide comment
@fisherman818

fisherman818 Aug 13, 2016

Found the solution:
react-native start
then reload the app.

Found the solution:
react-native start
then reload the app.

@laszl0

This comment has been minimized.

Show comment
Hide comment
@laszl0

laszl0 Aug 13, 2016

I got it to work by changing in the file .buckconfig the line:
target = Google Inc.:Google APIs:23
to
target = Google Inc.:Google APIs:24

Edited:
I was having the same exception on the device Z3 Compact D5803 - 6.0.1
Then i saw in SDK Manager that Android 6.X has api level 24 and not 23, then i changed.

laszl0 commented Aug 13, 2016

I got it to work by changing in the file .buckconfig the line:
target = Google Inc.:Google APIs:23
to
target = Google Inc.:Google APIs:24

Edited:
I was having the same exception on the device Z3 Compact D5803 - 6.0.1
Then i saw in SDK Manager that Android 6.X has api level 24 and not 23, then i changed.

@stoffern

This comment has been minimized.

Show comment
Hide comment
@stoffern

stoffern Aug 13, 2016

@fisherman818 as i said..
@laszl0 should not be a issue. RN is not dependent on API 24

@fisherman818 as i said..
@laszl0 should not be a issue. RN is not dependent on API 24

@fisherman818

This comment has been minimized.

Show comment
Hide comment
@fisherman818

fisherman818 Aug 14, 2016

@stoffern yes, you are right. thanks

@stoffern yes, you are right. thanks

@laurakelly

This comment has been minimized.

Show comment
Hide comment
@laurakelly

laurakelly Aug 22, 2016

This solution on Stack Overflow worked for me: http://stackoverflow.com/a/38874952/1880100

I am only seeing this issue on my 6.0.0 emulator, but not my 4.4.4 emulator

This solution on Stack Overflow worked for me: http://stackoverflow.com/a/38874952/1880100

I am only seeing this issue on my 6.0.0 emulator, but not my 4.4.4 emulator

@Mahluleli-Goodson

This comment has been minimized.

Show comment
Hide comment
@Mahluleli-Goodson

Mahluleli-Goodson Aug 23, 2016

If this is happening on physical device, do adb reverse tcp:8081 tcp:8081, then reload your app
Hope it helps!!

Mahluleli-Goodson commented Aug 23, 2016

If this is happening on physical device, do adb reverse tcp:8081 tcp:8081, then reload your app
Hope it helps!!

@calcyu

This comment has been minimized.

Show comment
Hide comment

calcyu commented Aug 26, 2016

可以看下这个
http://www.geek5.cn/?p=232

@Antibioticvz

This comment has been minimized.

Show comment
Hide comment
@Antibioticvz

Antibioticvz Aug 29, 2016

Anyone found the solution? (tried all here... )
I have this problem only for android 5.1

Antibioticvz commented Aug 29, 2016

Anyone found the solution? (tried all here... )
I have this problem only for android 5.1

@chespinoza

This comment has been minimized.

Show comment
Hide comment
@chespinoza

chespinoza Sep 1, 2016

I had the same problem with a clean installation, and I solved it with http://stackoverflow.com/questions/38870710/error-could-not-get-batchedbridge-make-sure-your-bundle-is-packaged-properly

I think this should be documented.

I had the same problem with a clean installation, and I solved it with http://stackoverflow.com/questions/38870710/error-could-not-get-batchedbridge-make-sure-your-bundle-is-packaged-properly

I think this should be documented.

@diegoarcega

This comment has been minimized.

Show comment
Hide comment
@diegoarcega

diegoarcega Sep 2, 2016

I had the same issue.

I first needed to run the server
react-native start

and then
react-native run-android

I had the same issue.

I first needed to run the server
react-native start

and then
react-native run-android

@sergionsz

This comment has been minimized.

Show comment
Hide comment
@sergionsz

sergionsz Sep 2, 2016

react-native start tells you what's wrong. In my case, there were other processes listening on port 8081. Solved it by getting them:

lsof -n -i4TCP:8081

and then killing them'all.

react-native start tells you what's wrong. In my case, there were other processes listening on port 8081. Solved it by getting them:

lsof -n -i4TCP:8081

and then killing them'all.

@changkun

This comment has been minimized.

Show comment
Hide comment
@changkun

changkun Sep 6, 2016

any feasible solution?

react-native start && react-native run-android is not working for me.

changkun commented Sep 6, 2016

any feasible solution?

react-native start && react-native run-android is not working for me.

@Antibioticvz

This comment has been minimized.

Show comment
Hide comment
@Antibioticvz

Antibioticvz Sep 6, 2016

@changkun Try to change an emulator device

@changkun Try to change an emulator device

@changkun

This comment has been minimized.

Show comment
Hide comment
@changkun

changkun Sep 7, 2016

@Antibioticvz cool! It works for me, just simply change the emulator from nexus5 to nexus 6.

changkun commented Sep 7, 2016

@Antibioticvz cool! It works for me, just simply change the emulator from nexus5 to nexus 6.

@Antibioticvz

This comment has been minimized.

Show comment
Hide comment
@Antibioticvz

Antibioticvz Sep 7, 2016

@changkun what the emulator do you use? I've got this problem for Genymotion -> nexus 5 (5.0.0 api21)

@changkun what the emulator do you use? I've got this problem for Genymotion -> nexus 5 (5.0.0 api21)

@changkun

This comment has been minimized.

Show comment
Hide comment
@changkun

changkun Sep 7, 2016

@Antibioticvz I was using Genymotion Nexus 5 (6.0.0, API 23), then I followed your suggestion change to Nexus 6 (6.0.0, API 23) everthing works fine.

However, now this error happens again... even to use the nexus 6 emulator...

changkun commented Sep 7, 2016

@Antibioticvz I was using Genymotion Nexus 5 (6.0.0, API 23), then I followed your suggestion change to Nexus 6 (6.0.0, API 23) everthing works fine.

However, now this error happens again... even to use the nexus 6 emulator...

@flexdhana

This comment has been minimized.

Show comment
Hide comment
@flexdhana

flexdhana Sep 8, 2016

This issue is frustrating me.. i tried in all the devices with Android 4.4, 5.0.1, 6.0.. and getting the same issue "could not get batchedbridge make sure your bundle is packaged correctly".. . please help me to fix.. its working fine in emulator, issue only on actual device.

I am using:
React Native
Android Studio
Android device (4.4, 5.0.1, 6.0)

flexdhana commented Sep 8, 2016

This issue is frustrating me.. i tried in all the devices with Android 4.4, 5.0.1, 6.0.. and getting the same issue "could not get batchedbridge make sure your bundle is packaged correctly".. . please help me to fix.. its working fine in emulator, issue only on actual device.

I am using:
React Native
Android Studio
Android device (4.4, 5.0.1, 6.0)

@etroynov

This comment has been minimized.

Show comment
Hide comment
@etroynov

etroynov Sep 13, 2016

For physical device in helps to me (in console):
adb reverse tcp:8081 tcp:8081

Environment:

  • Ubuntu 15.10
  • Android studio 2.1.3
  • HTC Desire 626G ( Android 6.0.1 )

p.s app build with android studio

etroynov commented Sep 13, 2016

For physical device in helps to me (in console):
adb reverse tcp:8081 tcp:8081

Environment:

  • Ubuntu 15.10
  • Android studio 2.1.3
  • HTC Desire 626G ( Android 6.0.1 )

p.s app build with android studio

@sumit6b

This comment has been minimized.

Show comment
Hide comment
@sumit6b

sumit6b Sep 15, 2016

This is happening on both of my emulator and mobile device, and none of the solutions working for me, sadly.

sumit6b commented Sep 15, 2016

This is happening on both of my emulator and mobile device, and none of the solutions working for me, sadly.

@hari2babloo

This comment has been minimized.

Show comment
Hide comment

Same Here

@sumit6b

This comment has been minimized.

Show comment
Hide comment
@sumit6b

sumit6b Sep 15, 2016

So I dig a little bit more and found that my <root>/android/app/build/intermediates/assets/debugfolder was empty and by running cd android && ./gradlew assembleDebug was not creating those files required, which are later used by javascript thread in our react native apps.

I ran manually the following command which the debug build command should have created ideally.

node node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --reset-cache --entry-file index.android.js --bundle-output /<path to dir>/android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest /<path to dir>/android/app/build/intermediates/res/merged/debug

After running these commands I found two bundle files in my <root>/android/app/build/intermediates/assets/debug

And then a I ran again cd android && ./gradlew installDebug my app started working again.

sumit6b commented Sep 15, 2016

So I dig a little bit more and found that my <root>/android/app/build/intermediates/assets/debugfolder was empty and by running cd android && ./gradlew assembleDebug was not creating those files required, which are later used by javascript thread in our react native apps.

I ran manually the following command which the debug build command should have created ideally.

node node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --reset-cache --entry-file index.android.js --bundle-output /<path to dir>/android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest /<path to dir>/android/app/build/intermediates/res/merged/debug

After running these commands I found two bundle files in my <root>/android/app/build/intermediates/assets/debug

And then a I ran again cd android && ./gradlew installDebug my app started working again.

@manavdahra

This comment has been minimized.

Show comment
Hide comment
@manavdahra

manavdahra Sep 18, 2016

@sumit6b Thanks, your solutions works for me.

@sumit6b Thanks, your solutions works for me.

@arhmnsh

This comment has been minimized.

Show comment
Hide comment
@arhmnsh

arhmnsh Sep 21, 2016

This issue also happens if your device is not on the same network as your dev machine.

arhmnsh commented Sep 21, 2016

This issue also happens if your device is not on the same network as your dev machine.

@liubobuzhidao

This comment has been minimized.

Show comment
Hide comment
@liubobuzhidao

liubobuzhidao Sep 23, 2016

I created a demo program,and run it on samsung 5.0 successfully, but failed to run on 4.4.4,The error is same with up, I have try to all the methods provided by provider,but no effect!

I created a demo program,and run it on samsung 5.0 successfully, but failed to run on 4.4.4,The error is same with up, I have try to all the methods provided by provider,but no effect!

@jiangqqlmj

This comment has been minimized.

Show comment
Hide comment
@jiangqqlmj

jiangqqlmj Sep 26, 2016

Android 4.4 OK
when 5.0 or 6.0 this is the same question

Android 4.4 OK
when 5.0 or 6.0 this is the same question

@liubobuzhidao

This comment has been minimized.

Show comment
Hide comment
@liubobuzhidao

liubobuzhidao Sep 29, 2016

However,I'm always wrong when running on android 4.4 ,but it's ok on api 21 +.

Update:I know the reason why I can't get the result what I want, You should check your phone first whether opened the Suspension box!

liubobuzhidao commented Sep 29, 2016

However,I'm always wrong when running on android 4.4 ,but it's ok on api 21 +.

Update:I know the reason why I can't get the result what I want, You should check your phone first whether opened the Suspension box!

@SarjuHansaliya

This comment has been minimized.

Show comment
Hide comment
@SarjuHansaliya

SarjuHansaliya Oct 3, 2016

@sumit6b Thanks , Your solution worked for me but I can't use it in dev build , everytime I change something and I have to build apk.Any help on that?

@sumit6b Thanks , Your solution worked for me but I can't use it in dev build , everytime I change something and I have to build apk.Any help on that?

@markortiz

This comment has been minimized.

Show comment
Hide comment
@markortiz

markortiz Oct 18, 2016

I'm having the same error and solve it by running solution that i found here http://stackoverflow.com/a/38874952/2840870

First I clean gradle by running

(cd android/ && gradlew clean)

Then start to bundle android by running:

node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.map --assets-dest android/app/src/main/res/

After that I run the script to make android build by running:

(cd android/ && gradlew assembleDebug)

And last I start to run my project by running react-native run-android
This error was solved now.

(Note: Since I'm using windows, I run this solution first on ming and the error is still exist and it does only create one bundle file under <root>/android/app/build/intermediates/assets/debug then I try to do this same solution in ming with Run as Administrator and it was able to create 2 bundle file under the same path)

(Note 2: I was able to fix this problem and display the main view of my project but still having issue on cmd which I think a separate error)

ERROR  UNKNOWN: unknown error, lstat 'c:\react-apps\qt-mobile-app\node_modules\.bin\JSONStream'
{"errno":-4094,"code":"UNKNOWN","syscall":"lstat","path":"c:\\react-apps\\qt-mobile-app\\node_modules\\.bin\\JSONStream"}
Error: UNKNOWN: unknown error, lstat 'c:\react-apps\qt-mobile-app\node_modules\.bin\JSONStream'
    at Error (native)

I'm having the same error and solve it by running solution that i found here http://stackoverflow.com/a/38874952/2840870

First I clean gradle by running

(cd android/ && gradlew clean)

Then start to bundle android by running:

node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.map --assets-dest android/app/src/main/res/

After that I run the script to make android build by running:

(cd android/ && gradlew assembleDebug)

And last I start to run my project by running react-native run-android
This error was solved now.

(Note: Since I'm using windows, I run this solution first on ming and the error is still exist and it does only create one bundle file under <root>/android/app/build/intermediates/assets/debug then I try to do this same solution in ming with Run as Administrator and it was able to create 2 bundle file under the same path)

(Note 2: I was able to fix this problem and display the main view of my project but still having issue on cmd which I think a separate error)

ERROR  UNKNOWN: unknown error, lstat 'c:\react-apps\qt-mobile-app\node_modules\.bin\JSONStream'
{"errno":-4094,"code":"UNKNOWN","syscall":"lstat","path":"c:\\react-apps\\qt-mobile-app\\node_modules\\.bin\\JSONStream"}
Error: UNKNOWN: unknown error, lstat 'c:\react-apps\qt-mobile-app\node_modules\.bin\JSONStream'
    at Error (native)
@ryanhomer

This comment has been minimized.

Show comment
Hide comment
@ryanhomer

ryanhomer Oct 21, 2016

Check to make sure that your MainApplication.java file does NOT have the following import:

import com.facebook.react.BuildConfig;

I inadvertently added this in error when I was changing my app's package name and somewhere along the way Android Studio complained that it could not find the class and suggested that I added it. If you do not have this, try invalidating your Android Studio cache and restarting Android Studio.

For me, this caused my app to use a release or cached version of BuildConfig which made return BuildConfig.DEBUG return false. If you leave this out, a generated version in your build folder will be used instead which, for debug builds, will return true.

Then, in DevSupportManagerFactory's create function, enableOnCreate will be true and will return a DevSupportManagerImpl class instead of a DisabledDevSupportManager class. This will cause your React Native app to access the package server instead of looking for an internal JS bundle.

public class DevSupportManagerFactory {
  ...
  public static DevSupportManager create(
    Context applicationContext,
    ReactInstanceDevCommandsHandler reactInstanceCommandsHandler,
    @Nullable String packagerPathForJSBundleName,
    boolean enableOnCreate,
    @Nullable RedBoxHandler redBoxHandler) {
    if (!enableOnCreate) {
      return new DisabledDevSupportManager();
    }
    try {
      // ProGuard is surprisingly smart in this case and will keep a class if it detects a call to
      // Class.forName() with a static string. So instead we generate a quasi-dynamic string to
      // confuse it.
      String className =
        new StringBuilder(DEVSUPPORT_IMPL_PACKAGE)
          .append(".")
          .append(DEVSUPPORT_IMPL_CLASS)
          .toString();
      Class<?> devSupportManagerClass =
        Class.forName(className);
      Constructor constructor =
        devSupportManagerClass.getConstructor(
          Context.class,
          ReactInstanceDevCommandsHandler.class,
          String.class,
          boolean.class,
          RedBoxHandler.class);
      return (DevSupportManager) constructor.newInstance(
        applicationContext,
        reactInstanceCommandsHandler,
        packagerPathForJSBundleName,
        true,
        redBoxHandler);
    } catch (Exception e) {
      throw new RuntimeException(
        "Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found" +
          " or could not be created",
        e);
    }
  }
}

ryanhomer commented Oct 21, 2016

Check to make sure that your MainApplication.java file does NOT have the following import:

import com.facebook.react.BuildConfig;

I inadvertently added this in error when I was changing my app's package name and somewhere along the way Android Studio complained that it could not find the class and suggested that I added it. If you do not have this, try invalidating your Android Studio cache and restarting Android Studio.

For me, this caused my app to use a release or cached version of BuildConfig which made return BuildConfig.DEBUG return false. If you leave this out, a generated version in your build folder will be used instead which, for debug builds, will return true.

Then, in DevSupportManagerFactory's create function, enableOnCreate will be true and will return a DevSupportManagerImpl class instead of a DisabledDevSupportManager class. This will cause your React Native app to access the package server instead of looking for an internal JS bundle.

public class DevSupportManagerFactory {
  ...
  public static DevSupportManager create(
    Context applicationContext,
    ReactInstanceDevCommandsHandler reactInstanceCommandsHandler,
    @Nullable String packagerPathForJSBundleName,
    boolean enableOnCreate,
    @Nullable RedBoxHandler redBoxHandler) {
    if (!enableOnCreate) {
      return new DisabledDevSupportManager();
    }
    try {
      // ProGuard is surprisingly smart in this case and will keep a class if it detects a call to
      // Class.forName() with a static string. So instead we generate a quasi-dynamic string to
      // confuse it.
      String className =
        new StringBuilder(DEVSUPPORT_IMPL_PACKAGE)
          .append(".")
          .append(DEVSUPPORT_IMPL_CLASS)
          .toString();
      Class<?> devSupportManagerClass =
        Class.forName(className);
      Constructor constructor =
        devSupportManagerClass.getConstructor(
          Context.class,
          ReactInstanceDevCommandsHandler.class,
          String.class,
          boolean.class,
          RedBoxHandler.class);
      return (DevSupportManager) constructor.newInstance(
        applicationContext,
        reactInstanceCommandsHandler,
        packagerPathForJSBundleName,
        true,
        redBoxHandler);
    } catch (Exception e) {
      throw new RuntimeException(
        "Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found" +
          " or could not be created",
        e);
    }
  }
}
@DevItWithDavid

This comment has been minimized.

Show comment
Hide comment
@DevItWithDavid

DevItWithDavid Nov 3, 2016

For me the problem was adb not being in my path. The Get Started page tells you to put ${ANDROID_HOME}/tools in your path, which i did but that folder does not contain the adb executable. I added ${ANDROID_HOME}/platform-tools to my path, because that folder does contain adb, and then react-native run-android worked on a device with usb.

DevItWithDavid commented Nov 3, 2016

For me the problem was adb not being in my path. The Get Started page tells you to put ${ANDROID_HOME}/tools in your path, which i did but that folder does not contain the adb executable. I added ${ANDROID_HOME}/platform-tools to my path, because that folder does contain adb, and then react-native run-android worked on a device with usb.

@thiagoribeir015

This comment has been minimized.

Show comment
Hide comment
@thiagoribeir015

thiagoribeir015 Nov 4, 2016

The comment from @jj199611 solved the "get BatchedBridge" problem. Added ${ANDROID_HOME}/platform-tools to my path and it's working fine now.

The comment from @jj199611 solved the "get BatchedBridge" problem. Added ${ANDROID_HOME}/platform-tools to my path and it's working fine now.

@shuangshan

This comment has been minimized.

Show comment
Hide comment
@shuangshan

shuangshan Nov 5, 2016

My case:

  1. open Dev setting by type command + M
  2. put 127.0.0.1:8081 in Debug server host & port

issue gone. hope help.

My case:

  1. open Dev setting by type command + M
  2. put 127.0.0.1:8081 in Debug server host & port

issue gone. hope help.

@LibuMathew

This comment has been minimized.

Show comment
Hide comment

@sumit6b Thanks

@megahertz

This comment has been minimized.

Show comment
Hide comment
@megahertz

megahertz Nov 23, 2016

I have had the same problem when trying to make index.js as the entry point (index.ios.js and index.android.js was just "require('./index')").

I have had the same problem when trying to make index.js as the entry point (index.ios.js and index.android.js was just "require('./index')").

@Vadorequest

This comment has been minimized.

Show comment
Hide comment
@Vadorequest

Vadorequest Jan 29, 2017

Just getting started with React-Native, I got into troubles, couldn't make anything work.

Basically, using a virtual device I couldn't get it to connect. When starting the device from android avd interface, I got bind: Transport endpoint is not connected. I still haven't figured out that part.

I went using my own Android OnePlus One, yet, troubles again. But I got it working with the following steps:

Getting started

Physical device (easier)

  1. Port proxy for physical device (-d will automatically target physical device)
    adb -d reverse tcp:8081 tcp:8081

  2. Start ADB server
    adb start-server

  3. Run react-native server for hot reloading
    react-native start

  4. Start Android app on the physical device
    react-native run-android (~30sec)

  5. Shake the device and enable Hot reloading and Live Reload (useful the first time)


I hope it will helps some of you folks! Meanwhile, if anyone has any idea about the Transport endpoint thing, please share ;)

Just getting started with React-Native, I got into troubles, couldn't make anything work.

Basically, using a virtual device I couldn't get it to connect. When starting the device from android avd interface, I got bind: Transport endpoint is not connected. I still haven't figured out that part.

I went using my own Android OnePlus One, yet, troubles again. But I got it working with the following steps:

Getting started

Physical device (easier)

  1. Port proxy for physical device (-d will automatically target physical device)
    adb -d reverse tcp:8081 tcp:8081

  2. Start ADB server
    adb start-server

  3. Run react-native server for hot reloading
    react-native start

  4. Start Android app on the physical device
    react-native run-android (~30sec)

  5. Shake the device and enable Hot reloading and Live Reload (useful the first time)


I hope it will helps some of you folks! Meanwhile, if anyone has any idea about the Transport endpoint thing, please share ;)

@nsreenath

This comment has been minimized.

Show comment
Hide comment
@nsreenath

nsreenath Feb 1, 2017

I got the error when running react-native run-android for the first time on a device (Moto G4 Plus, Android 7.0), when following the official getting started docs. I ran the same command again and the error is gone! The only difference was that in the first run, gradle and dependencies got downloaded.

Could it be an issue with the part of the code of react-native run-android where it downloads gradle and dependencies?

I got the error when running react-native run-android for the first time on a device (Moto G4 Plus, Android 7.0), when following the official getting started docs. I ran the same command again and the error is gone! The only difference was that in the first run, gradle and dependencies got downloaded.

Could it be an issue with the part of the code of react-native run-android where it downloads gradle and dependencies?

@docotronic

This comment has been minimized.

Show comment
Hide comment
@docotronic

docotronic Feb 3, 2017

For the Android Emulator:
While it appears pretty crazy it seems that if you have turned off cellular Data Status in the Android Emulator and restart the App the Conenction can not be established. After Enabling Data Connection again the Emulator is able to connect to the packager again. However this does not happen if you change the status while the App is open.
Maybe this helps someone.

For the Android Emulator:
While it appears pretty crazy it seems that if you have turned off cellular Data Status in the Android Emulator and restart the App the Conenction can not be established. After Enabling Data Connection again the Emulator is able to connect to the packager again. However this does not happen if you change the status while the App is open.
Maybe this helps someone.

@bathpp

This comment has been minimized.

Show comment
Hide comment
@bathpp

bathpp Feb 3, 2017

@sumit6b Thanks! Been stucking on this for hours until I found your solution.

bathpp commented Feb 3, 2017

@sumit6b Thanks! Been stucking on this for hours until I found your solution.

@kamal333k

This comment has been minimized.

Show comment
Hide comment
@kamal333k

kamal333k Feb 4, 2017

I faced the same error, which I resolved by connection my phone with the development server
adb reverse tcp:8081 tcp:8081
(this works on android 5.0 and above).
for more details you can refer the docs.
https://facebook.github.io/react-native/docs/running-on-device.html

I faced the same error, which I resolved by connection my phone with the development server
adb reverse tcp:8081 tcp:8081
(this works on android 5.0 and above).
for more details you can refer the docs.
https://facebook.github.io/react-native/docs/running-on-device.html

@flyfei

This comment has been minimized.

Show comment
Hide comment
@flyfei

flyfei Feb 7, 2017

  1. Create the android/app/src/main/assets folder

  2. run react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.map --assets-dest android/app/src/main/res/ on the project root

    Then assets will generate three files index.android.bundle index.android.bundle.meta index.android.map

  3. Last run project react-native run-android

Test Success Device: HUAWEI MATE 7 Android 4.4.2

flyfei commented Feb 7, 2017

  1. Create the android/app/src/main/assets folder

  2. run react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.map --assets-dest android/app/src/main/res/ on the project root

    Then assets will generate three files index.android.bundle index.android.bundle.meta index.android.map

  3. Last run project react-native run-android

Test Success Device: HUAWEI MATE 7 Android 4.4.2

@dothanhlam

This comment has been minimized.

Show comment
Hide comment
@dothanhlam

dothanhlam Feb 11, 2017

@Vadorequest solution just worked well. But I must install 'watchman' and change the target sdk to 24 (instead 23)

@Vadorequest solution just worked well. But I must install 'watchman' and change the target sdk to 24 (instead 23)

@psam44

This comment has been minimized.

Show comment
Hide comment
@psam44

psam44 Feb 11, 2017

A fix is submitted in issue #12344. It should at least cover some cases (or workarounds) described here.

psam44 commented Feb 11, 2017

A fix is submitted in issue #12344. It should at least cover some cases (or workarounds) described here.

@thatsVishal

This comment has been minimized.

Show comment
Hide comment
@thatsVishal

thatsVishal Feb 16, 2017

Just uninstall the app and run react-native run-android it worked for me

Just uninstall the app and run react-native run-android it worked for me

@sibelius

This comment has been minimized.

Show comment
Hide comment
@sibelius

sibelius Mar 1, 2017

@Zygro can we close this?

sibelius commented Mar 1, 2017

@Zygro can we close this?

@iroshanAV

This comment has been minimized.

Show comment
Hide comment
@iroshanAV

iroshanAV Mar 4, 2017

How can we run app on android v4 devices :( i'm still getting this error

How can we run app on android v4 devices :( i'm still getting this error

@onstash onstash referenced this issue Mar 17, 2017

Closed

Update GettingStarted.md #12998

0 of 4 tasks complete
@helloworldtang

This comment has been minimized.

Show comment
Hide comment
@helloworldtang

helloworldtang Mar 30, 2017

Solution:
under "react-native" directory:
after run command "./gradlew :Examples:UIExplorer:android:app:installDebug" successfully,
run commnad "./packager/packager.sh" successfuly.
then click "UIExplorer App“ in the emulator or the device

Solution:
under "react-native" directory:
after run command "./gradlew :Examples:UIExplorer:android:app:installDebug" successfully,
run commnad "./packager/packager.sh" successfuly.
then click "UIExplorer App“ in the emulator or the device

@alfonsogoberjr

This comment has been minimized.

Show comment
Hide comment
@alfonsogoberjr

alfonsogoberjr Apr 3, 2017

@sumit6b's solution worked for me, using Bluestacks

@sumit6b's solution worked for me, using Bluestacks

@pickfire

This comment has been minimized.

Show comment
Hide comment
@pickfire

pickfire Apr 7, 2017

It works after I did adb reverse tcp:8081 tcp:8081.

pickfire commented Apr 7, 2017

It works after I did adb reverse tcp:8081 tcp:8081.

@siddhant91

This comment has been minimized.

Show comment
Hide comment
@siddhant91

siddhant91 Apr 15, 2017

Hello, I am trying to run my react native app but i am not able to resolve the issue "Android error “Could not get BatchedBridge, make sure your bundle is packaged properly” on start of app" , is there any fix for it , i cannot find any solution on web either.

Hello, I am trying to run my react native app but i am not able to resolve the issue "Android error “Could not get BatchedBridge, make sure your bundle is packaged properly” on start of app" , is there any fix for it , i cannot find any solution on web either.

@siddhant91

This comment has been minimized.

Show comment
Hide comment
@siddhant91

siddhant91 Apr 15, 2017

Hi , I also get the below error Execution failed for task ':app:processDebugResources'.

java.io.IOException: Could not delete path

Does anyone has a solution on how can i run the app on emulator ???

Hi , I also get the below error Execution failed for task ':app:processDebugResources'.

java.io.IOException: Could not delete path

Does anyone has a solution on how can i run the app on emulator ???

@siddhant91

This comment has been minimized.

Show comment
Hide comment
@siddhant91

siddhant91 Apr 17, 2017

@sumit6b your solution worked for me, thanks a lot. But how can i also have hot reload with this, as with your solution i will have to build my app every time when i make any changes.

@sumit6b your solution worked for me, thanks a lot. But how can i also have hot reload with this, as with your solution i will have to build my app every time when i make any changes.

@markortiz

This comment has been minimized.

Show comment
Hide comment
@rewieer

This comment has been minimized.

Show comment
Hide comment
@rewieer

rewieer Apr 20, 2017

@ryanhomer thanks i also had included that Debug thing and I could not load the developer menu anymore, that's great ! 🙌

rewieer commented Apr 20, 2017

@ryanhomer thanks i also had included that Debug thing and I could not load the developer menu anymore, that's great ! 🙌

@nik

This comment has been minimized.

Show comment
Hide comment
@nik

nik Apr 20, 2017

@ryanhomer saved my life. thanks

nik commented Apr 20, 2017

@ryanhomer saved my life. thanks

@Cedrigax

This comment has been minimized.

Show comment
Hide comment
@Cedrigax

Cedrigax Apr 25, 2017

@markortiz you saved my day. Thanks!!
$ adb reverse tcp:8081 tcp:8081

Cedrigax commented Apr 25, 2017

@markortiz you saved my day. Thanks!!
$ adb reverse tcp:8081 tcp:8081

@ravirajn22

This comment has been minimized.

Show comment
Hide comment
@ravirajn22

ravirajn22 May 10, 2017

Try this option if you have this problem in android emulator,

open your emulator goto more options present outside the emulator, in that select 'cellular'.
In cellular, try changing Data status (to 'Denied' or 'Home' in my case it was in 'Roaming' which was causing the problem) and reload. You could also try changing Network type and check if its working.

Note: This is just one of the possible solution which worked for me, hence try other solutions if it doesn't work.
All the best..

ravirajn22 commented May 10, 2017

Try this option if you have this problem in android emulator,

open your emulator goto more options present outside the emulator, in that select 'cellular'.
In cellular, try changing Data status (to 'Denied' or 'Home' in my case it was in 'Roaming' which was causing the problem) and reload. You could also try changing Network type and check if its working.

Note: This is just one of the possible solution which worked for me, hence try other solutions if it doesn't work.
All the best..

@yogieputra8

This comment has been minimized.

Show comment
Hide comment
@yogieputra8

yogieputra8 Jun 19, 2017

@stoffern Thank you, mate. You saved my day 👍🏻.
I am successfully solved this problem using:

react-native run-android
react-native start --reset-cache

@stoffern Thank you, mate. You saved my day 👍🏻.
I am successfully solved this problem using:

react-native run-android
react-native start --reset-cache
@stoffern

This comment has been minimized.

Show comment
Hide comment
@stoffern

stoffern Jun 19, 2017

why is this still open?
@hramos agree to close it? #9336 (comment) 😉

why is this still open?
@hramos agree to close it? #9336 (comment) 😉

@xedixermawan

This comment has been minimized.

Show comment
Hide comment
@xedixermawan

xedixermawan Oct 31, 2017

this bug happen when I used RELEASE version build config. switch to DEBUG version fix this issue .

this bug happen when I used RELEASE version build config. switch to DEBUG version fix this issue .

@bineeshbabu

This comment has been minimized.

Show comment
Hide comment
@bineeshbabu

bineeshbabu Dec 7, 2017

This works for me

  1. npm cache clean --force
  2. react-native start
  3. react-native run-android

bineeshbabu commented Dec 7, 2017

This works for me

  1. npm cache clean --force
  2. react-native start
  3. react-native run-android
@Latif-Stellent

This comment has been minimized.

Show comment
Hide comment
@Latif-Stellent

Latif-Stellent Jun 21, 2018

try this......
export PATH="$HOME/Library/Android/sdk//platform-tools":$PATH
after run this....
react-native run-android

Latif-Stellent commented Jun 21, 2018

try this......
export PATH="$HOME/Library/Android/sdk//platform-tools":$PATH
after run this....
react-native run-android

@JeffLoo-ong

This comment has been minimized.

Show comment
Hide comment
@JeffLoo-ong

JeffLoo-ong Jul 11, 2018

This might be useful for someone who is in the same situation I'm in but if you get a "watch" error after attempting to run "react-native start" take a look at the solution by @grit96 fbsamples/f8app#55

This might be useful for someone who is in the same situation I'm in but if you get a "watch" error after attempting to run "react-native start" take a look at the solution by @grit96 fbsamples/f8app#55

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.