You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 4, 2021. It is now read-only.
Documentation for running in release/production? #7
I tried running a production version (Scheme -> Build Configuration = Release), the main bundle loads and attempts to start the worker, but this just repeats in my logs:
I added the worker.js file to my project folder and can confirm it's being copied to the same folder. But it looks like the worker is trying to load the wrong file? The main.jsbundle file is the output of the react native packager, right?
So, my Objective-C skills are nonexistent, but it seems to work if I hardcode the path to the worker bundle:
Steps to get it working:
Build an offline bundle of the worker file: react-native bundle --platform ios --dev false --entry-file worker.js --bundle-output iOS/worker.jsbundle
Add the worker.jsbundle file to the XCode project. (In the Project Navigator click on the app name, then right click and select Add Files to ...)
In WorkerManager.m change the *workerURL line to point to the file: NSURL *workerURL = [[NSBundle mainBundle] URLForResource:@"worker" withExtension:@"jsbundle"];
D/WorkerManager( 7970): Starting web worker - src/workers/printers/worker
D/WorkerManager( 7970): createReleaseBundleLoader - reading file from assets
E/ ( 7970): Unable to load script from assets: workers/src_workers_printers_worker.bundle
W/System.err( 7970): java.lang.RuntimeException: Could not connect to development server.
10-30 17:02:08.119 25730 25754 W System.err: java.lang.RuntimeException: Could not get BatchedBridge, make sure your bundle is packaged correctly
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(Native Method)
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:177)
10-30 17:02:08.120 25730 25754 W System.err: at co.apptailor.Worker.core.ReactContextBuilder$1.call(ReactContextBuilder.java:90)
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$1.run(MessageQueueThreadImpl.java:74)
10-30 17:02:08.120 25730 25754 W System.err: at android.os.Handler.handleCallback(Handler.java:751)
10-30 17:02:08.120 25730 25754 W System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
10-30 17:02:08.120 25730 25754 W System.err: at android.os.Looper.loop(Looper.java:154)
10-30 17:02:08.120 25730 25754 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
10-30 17:02:08.120 25730 25754 W System.err: at java.lang.Thread.run(Thread.java:761)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
10-30 17:02:08.124 25730 25749 E AndroidRuntime: Process: com.polarh7rr, PID: 25730
10-30 17:02:08.124 25730 25749 E AndroidRuntime: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not get BatchedBridge, make sure your bundle is packaged correctly
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:144)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at co.apptailor.Worker.WorkerModule.startWorker(WorkerModule.java:81)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:751)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at java.lang.Thread.run(Thread.java:761)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not get BatchedBridge, make sure your bundle is packaged correctly
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.common.futures.SimpleSettableFuture.get(SimpleSettableFuture.java:68)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at co.apptailor.Worker.core.ReactContextBuilder.build(ReactContextBuilder.java:99)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at co.apptailor.Worker.JSWorker.runFromContext(JSWorker.java:35)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at co.apptailor.Worker.WorkerModule.startWorker(WorkerModule.java:72)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: ... 10 more
10-30 17:02:08.124 25730 25749 E AndroidRuntime: Caused by: java.lang.RuntimeException: Could not get BatchedBridge, make sure your bundle is packaged correctly
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(Native Method)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:177)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at co.apptailor.Worker.core.ReactContextBuilder$1.call(ReactContextBuilder.java:90)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$1.run(MessageQueueThreadImpl.java:74)
10-30 17:02:08.124 25730 25749 E AndroidRuntime: ... 6 more
10-30 17:02:08.126 27236 3347 W ActivityManager: Force finishing activity com.polarh7rr/.MainActivity
(my app's name is com.polarh7rr)
Even though the src/worker.js is empty, I keep receiving the exception above.
Activity
seantempesta commentedon Aug 3, 2016
So, my Objective-C skills are nonexistent, but it seems to work if I hardcode the path to the worker bundle:
Steps to get it working:
react-native bundle --platform ios --dev false --entry-file worker.js --bundle-output iOS/worker.jsbundleworker.jsbundlefile to the XCode project. (In the Project Navigator click on the app name, then right click and selectAdd Files to ...)WorkerManager.mchange the*workerURLline to point to the file:NSURL *workerURL = [[NSBundle mainBundle] URLForResource:@"worker" withExtension:@"jsbundle"];fampinheiro commentedon Aug 3, 2016
Having the same issue in android
Listing the assets I can't see the workers asset
fampinheiro commentedon Aug 3, 2016
A possible way to overcome this is to create the workers manually
react-native bundle --entry-file ./src/workers/printers/worker.js --platform android --bundle-output android/app/src/main/assets/workers/src_workers_printers_worker.bundledevfd commentedon Aug 3, 2016
yes it is on the todo list. but basically it is just a matter of calling the RN packager and writing the worker bundle file at the correct location.
RichardBoyewa commentedon Sep 20, 2016
When are you adding this please @devfd
RichardBoyewa commentedon Sep 27, 2016
Ok. I have done this. Its working now.
oroce commentedon Oct 30, 2016
Anyone else seeing issues with RN 0.35?
I have a
src/worker.jsand in my code I'm doing:new Worker('src/worker');.For the android bundle I'm running:
(my app's name is
com.polarh7rr)Even though the
src/worker.jsis empty, I keep receiving the exception above.therealgilles commentedon Nov 17, 2016
I'm having the same issue. WorkerManager.m looks like this:
NSURL *workerURL = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:name fallbackResource:nil];
How do I find out where I am supposed to write bundle for iOS?