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 :
- Install Choco / Node / React-native
- Go into workspace folder and call
react-native init AwesomeProject
Success.
- Launching a new Android Emulator ( > adb devices sees it) then run
cd ./AwesomeProject
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)