2

I've been trying to launch the AwesomeProject app for two days, not a success.

I followed step-by-step the Getting started Tutorial (v0.42 for Windows/Android).

This is what I've done :

  1. Install Choco / Node / React-native
  2. Go into workspace folder and call

    react-native init AwesomeProject

Success.

  1. Launching a new Android Emulator ( > adb devices sees it) then run

    cd ./AwesomeProject

  2. react-native run-android

I get the following : A new command prompt window is launched for react-packager, starts then wait forever like this :

Scanning 557 folders for symlinks in C:\xxx\zzz\yyy\workspace\react-
native\AwesomeProject\node_modules (31ms)
 ┌────────────────────────────────────────────────────────────────────────────┐

 │  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
   C:\xxx\yyy\zzz\workspace\react-native\AwesomeProject

Loading dependency graph...
React packager ready.

Loading dependency graph, done.

On the Emulator, Red screen with useless message "Could not get BatchedBridge, make sure your bundle is packaged correctly"

"Could not get BatchedBridge, ...

On the first command prompt (where I call run-android) :

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug...
Using maven environment 'default'
:app:preBuild UP-TO-DATE
[... everything seems ok...]
:app:installDebug
Installing APK 'app-debug.apk' on 'emulator-5554 - 4.4.2'
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 1 mins 44.307 secs
Running C:\dev\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081
tcp:8081
error: closed
Could not run adb reverse: Command failed: C:\dev\Android\sdk/platform-tools/adb
 -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (C:\dev\Android\sdk/platform-tools/adb -s emul
ator-5554 shell am start -n com.awesomeproject/.MainActivity)...
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a
 security risk. Please fix.
Starting: Intent { cmp=com.awesomeproject/.MainActivity }

In Android Studio's Android monitor I have for the Emulator :

02-08 03:45:31.850 2472-2533/com.awesomeproject E/unknown:React: Exception in native call from JS
                                                                 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: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:196)
                                                                     at java.lang.Thread.run(Thread.java:841)
                                                                  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: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:196) 
                                                                     at 

java.lang.Thread.run(Thread.java:841) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
                                                                               at java.lang.Thread.run(Thread.java:818) 

If I hit Reload (R,R) in the Emulator, I have now the error screen "Could not connect to development server."

Could not connect to development server...

No idea what to do at this point.

This https://stackoverflow.com/a/38874952/3249701 does absolutly nothing.

Neither does this https://stackoverflow.com/a/40500277/3249701

Where can I get the correct stacktrace or a pertinent Log message to know where I've went wrong ?

Thanks,

EDIT :

Now, React Packager isn't fully starting. It's freezes after following message :

Scanning 557 folders for symlinks in C:\xxx\yyy\zzz\workspace\AwesomeProject\node_modules (61ms)
 ┌────────────────────────────────────────────────────────────────────────────┐

 │  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
   C:\xxx\yyy\zzz\workspace\AwesomeProject

Loading dependency graph...
React packager ready.

Loading dependency graph, done.

I tried to set my IP in the Dev Settings (got from > ipconfig), no success. I went back to 10.0.1.1:8081, but now the Package Manager can't get the application at all. The more I try, the more it becomes messed up.

On the Emulator I tried to shake it, go to Dev Setting, set the Host to empty, than reload. I got following error :

02-07 16:40:16.056 2949-2949/com.awesomeproject E/unknown:React: Exception in native call
                                                                 com.facebook.react.devsupport.DebugServerException: Could not connect to development server.

                                                                 Try the following to fix the issue:
                                                                 • Ensure that the packager server is running
                                                                 • Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
                                                                 • Ensure Airplane Mode is disabled
                                                                 • If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
                                                                 • If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081

                                                                 URL: http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
                                                                     at com.facebook.react.devsupport.DevServerHelper$5.onFailure(DevServerHelper.java:296)
                                                                     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
                                                                     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                     at java.lang.Thread.run(Thread.java:761)
                                                                  Caused by: java.io.IOException: unexpected end of stream on okhttp3.Address@59b3133f
                                                                     at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:201)
                                                                     at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
                                                                     at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                     at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                     at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                     at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                     at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
                                                                     at okhttp3.RealCall.access$100(RealCall.java:33)
                                                                     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
                                                                     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                     at java.lang.Thread.run(Thread.java:761) 
                                                                  Caused by: java.io.EOFException: \n not found: size=0 content=…
                                                                     at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:215)
                                                                     at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
                                                                     at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127) 
                                                                     at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
                                                                     at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
                                                                     at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
                                                                     at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
                                                                     at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
                                                                     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
                                                                     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 
                                                                     at okhttp3.RealCall.access$100(RealCall.java:33) 
                                                                     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 
                                                                     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                     at java.lang.Thread.run(Thread.java:761) 
Community
  • 1
  • 1
Memo36
  • 21
  • 2
  • 5
  • Are you trying to run your app on a device or the emulator? – NoilPaw Feb 07 '17 at 16:07
  • Excatly same result. I've edited my question, ReactPackager is just not launching. No idea why tho. – Memo36 Feb 07 '17 at 16:20
  • "Loading dependency graph, done." is all right as the last message. It's waiting for your app to connect. – NoilPaw Feb 07 '17 at 16:24
  • Yeah but then the app starts and the Error message appears without any stack trace, as I stated =( – Memo36 Feb 07 '17 at 16:26
  • Did you execute the following? adb reverse tcp:8081 tcp:8081 – NoilPaw Feb 08 '17 at 11:18
  • I get error: closed (first time I see this error...) – Memo36 Feb 08 '17 at 13:02
  • Can you post a screenshot with this error? Did you have a look at the troubleshooting page? Maybe there is another process blocking the port. "On Windows you can find the process using port 8081 using Resource Monitor and stop it using Task Manager." https://facebook.github.io/react-native/docs/troubleshooting.html – NoilPaw Feb 10 '17 at 09:41

4 Answers4

1

I have the same problem. I have not found complete solution but I could launch app in device indirectly by following Akhi's instruction with little addition.

  1. Create blank assets Folder in ./android/app/src/main/ folder.
  2. react-native bundle --entry-file index.android.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/. This step did not show any error.
  3. Open Android Studio, open project with respect to android folder.
  4. In terminal window run: gradlew.
  5. Android Studio' Run command to launch app in Virtual device/mobile phone.

I am still awaiting complete solution by React-native.

legoscia
  • 39,593
  • 22
  • 116
  • 167
niranjan
  • 19
  • 2
0

Run npm test in your project root folder directory on terminal if there is some error then it will show the issue. If there is no issue then run command npm start and run your project from android studio on any android device. After launch set the IP address of your machine to dev settings followed by port 8081 and then reload.

Akhilesh Mourya
  • 666
  • 1
  • 4
  • 15
  • The tests passed successfully. When I do the spm start then run on Android I have the same results : the package manager is stuck after Loading graph, waiting the application to connect. When the application is launched, dummy "Not bridge" error message appears. If I shake the emulator then do a reload, it tells me that it can't connect to the packager. Setting the IP in Dev settings or leaving it blank does not change anything... – Memo36 Feb 08 '17 at 08:29
  • run this command in your project root directory on terminal: react-native bundle --entry-file index.android.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ And run again – Akhilesh Mourya Feb 08 '17 at 10:13
  • I ran the command. Whil it was on "Loading dependency graph, done." I did a Reload on the Emulator. Got the second picture error screen. In the index.android.bundle file there's a looot of things... – Memo36 Feb 08 '17 at 10:21
0

The answer is open two terminals

Terminal 1: Go to the react-native project and run the command react-native start

Terminal 2: Go to the react-native project and run the command react-native run-android

This error won't come.Try this solution.It will work.This thing is missing in the react native documentation.

ScientificMethod
  • 493
  • 3
  • 10
Shubham Panda
  • 87
  • 2
  • 4
  • Hi, this is not working. When I run react-native start, the packager opens. Then, when I run react-native run-android, it opens AGAIN the packager, wich tells me the port is already used (by the first terminal) – Memo36 Feb 10 '17 at 11:32
0

"Loading dependency graph, done." Stuck Solution

Check the permission and allow pop-ups

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Olgar
  • 1