The app compiles and runs without errors in development mode (ns run and ns debug), but when I build (ns build) the application crashes when trying to open. I added the minimize=false option in webpack to better understand the error (analyzed via adb logcat):
09-02 08:57:05.615 27443 27443 I TNS.Runtime: NativeScript Runtime Version 8.8.2, commit e2de001c0293495e1248d2e4cde752be70430add
09-02 08:57:05.690 27443 27443 D TNS.Runtime: V8 version 10.3.22
09-02 08:57:06.817 15884 15959 I WorkerManager: dispose()
09-02 08:57:07.326 27443 27443 D AndroidRuntime: Shutting down VM
09-02 08:57:07.326 27443 27443 E AndroidRuntime: FATAL EXCEPTION: main
09-02 08:57:07.326 27443 27443 E AndroidRuntime: Process: com.myapp, PID: 27443
09-02 08:57:07.326 27443 27443 E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
09-02 08:57:07.326 27443 27443 E AndroidRuntime: TypeError: Cannot read properties of undefined (reading 'content')
09-02 08:57:07.326 27443 27443 E AndroidRuntime: File: (file:///data/data/com.myapp/files/app/vendor.js:104384:95)
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: StackTrace:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: 9424(file:///data/data/com.myapp/files/app/vendor.js:104384:96)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__(file:///data/data/com.myapp/files/app/runtime.js:23:42)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at 11(file:///data/data/com.myapp/files/app/bundle.js:6460:30)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__(file:///data/data/com.myapp/files/app/runtime.js:23:42)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_exec__(file:///data/data/com.myapp/files/app/bundle.js:9416:39)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9417:114)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__.X(file:///data/data/com.myapp/files/app/runtime.js:114:21)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9417:47)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9422:3)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at require(:1:266)
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: TypeError: Cannot read properties of undefined (reading 'content')
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6798)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7934)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: Caused by: com.tns.NativeScriptException: Error calling module function
09-02 08:57:07.326 27443 27443 E AndroidRuntime: TypeError: Cannot read properties of undefined (reading 'content')
09-02 08:57:07.326 27443 27443 E AndroidRuntime: File: (file:///data/data/com.myapp/files/app/vendor.js:104384:95)
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: StackTrace:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: 9424(file:///data/data/com.myapp/files/app/vendor.js:104384:96)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__(file:///data/data/com.myapp/files/app/runtime.js:23:42)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at 11(file:///data/data/com.myapp/files/app/bundle.js:6460:30)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__(file:///data/data/com.myapp/files/app/runtime.js:23:42)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_exec__(file:///data/data/com.myapp/files/app/bundle.js:9416:39)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9417:114)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at __webpack_require__.X(file:///data/data/com.myapp/files/app/runtime.js:114:21)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9417:47)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at (file:///data/data/com.myapp/files/app/bundle.js:9422:3)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at require(:1:266)
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime:
09-02 08:57:07.326 27443 27443 E AndroidRuntime: TypeError: Cannot read properties of undefined (reading 'content')
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.tns.Runtime.runModule(Native Method)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.tns.Runtime.runModule(Runtime.java:689)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.tns.Runtime.run(Runtime.java:681)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1283)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6793)
09-02 08:57:07.326 27443 27443 E AndroidRuntime: ... 9 more
Looking inside the apk for the vendor.js file on line 104384:
The app compiles and runs without errors in development mode (
ns run
andns debug
), but when I build (ns build
) the application crashes when trying to open. I added theminimize=false
option in webpack to better understand the error (analyzed viaadb logcat
):Looking inside the apk for the
vendor.js
file on line104384
:Build command:
Versions: