Unable to run release in android
See original GitHub issueHello
I’m trying to run my build in release mode for Android but the app keeps crashing, my plan is to run native code that I have made in C++ which works fine when I call it in debug mode. In release mode I get:
--------- beginning of crash
2018-11-21 14:00:30.768 15410-15451/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.kulascope, PID: 15410
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to load script from assets 'threads/..worker.thread.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:22)
at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:170)
This comes even though if I take out the native call and only do a simple post message inside the worker.thread.js which is the name of my worker. I followed the simpleExample structure but it seems to be an issue there as well.
I have my worker.thread.bundle inside project/android/app/src/main/assets/threads/ and worker.thread.js in my project folder.
I ran the command
sudo node node_modules/react-native/local-cli/cli.js bundle --dev false --assets-dest ./android/app/src/main/res/ --entry-file worker.thread.js --platform android --bundle-output ./android/app/src/main/assets/threads/worker.thread.bundle
I’m running react-native: 0.55.2 react-native-threads: 0.0.13 I use this version in relation to this bug
What am I doing wrong ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top GitHub Comments
When you initialize your thread object with
new Thread('path/to/thread')
the path should be different in release and development mode. In development mode, path to thread should be relative to file in which thread is initialized, for examplenew Thread('../../index.thread.js')
. But in release mode, when you initialize thread, application is looking for your assets/thread folder as root. So you need to initialize your threads withnew Thread('index.thread.js')
.@nickymagic this solved this issue