NativeScript: Snapshot error after update tns-core-modules to 6.5.5

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.7.4
  • Cross-platform modules: angular
  • Android Runtime: “version”: “6.5.1”
  • iOS Runtime: “version”: “6.5.1”
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.7.4 version and is up to date.
✔ Component tns-core-modules has 6.5.5 version and is up to date.
✔ Component tns-android has 6.5.1 version and is up to date.
✔ Component tns-ios has 6.5.1 version and is up to date.
  • Plugin(s):
  "nativescript": {
        "id": "com.shipsfocus.bal",
        "tns-android": {
            "version": "6.5.1"
        },
        "tns-ios": {
            "version": "6.5.1"
        }
    },
    "dependencies": {
        "@angular/animations": "~8.2.0",
        "@angular/common": "~8.2.0",
        "@angular/compiler": "~8.2.0",
        "@angular/core": "~8.2.0",
        "@angular/forms": "~8.2.0",
        "@angular/http": "8.0.0-beta.10",
        "@angular/platform-browser": "~8.2.0",
        "@angular/platform-browser-dynamic": "~8.2.0",
        "@angular/router": "~8.2.0",
        "@ngx-translate/core": "^10.0.2",
        "@nstudio/nativescript-floatingactionbutton": "^1.1.0",
        "@nstudio/nativescript-loading-indicator": "^2.0.0",
        "@types/moment-timezone": "0.5.12",
        "moment": "2.24.0",
        "moment-timezone": "0.5.25",
        "nativescript-accelerometer": "3.0.0",
        "nativescript-angular": "~8.2.0",
        "nativescript-appversion": "^1.4.2",
        "nativescript-background-http": "^4.2.0",
        "nativescript-camera": "4.5.0",
        "nativescript-cfalert-dialog": "^1.0.15",
        "nativescript-contacts": "^1.6.2",
        "nativescript-fingerprint-auth": "^7.0.2",
        "nativescript-geolocation": "5.1.0",
        "nativescript-image": "^3.0.0",
        "nativescript-imagecropper": "^3.0.0",
        "nativescript-imagepicker": "^7.1.0",
        "nativescript-insomnia": "^1.2.3",
        "nativescript-intl": "~3.0.0",
        "nativescript-iqkeyboardmanager": "^1.5.1",
        "nativescript-localstorage": "2.0.1",
        "nativescript-mapbox": "./app/shared/nativescript-mapbox-4.3.1-york.tgz",
        "nativescript-ng-shadow": "^2.1.0",
        "nativescript-permissions": "^1.3.9",
        "nativescript-phone": "^1.4.0",
        "nativescript-plugin-firebase": "^10.3.0",
        "nativescript-rotate-3d": "^0.8.0",
        "nativescript-social-share": "1.5.2",
        "nativescript-theme-core": "~2.0.24",
        "nativescript-ui-autocomplete": "~6.0.0",
        "nativescript-ui-calendar": "~6.0.0",
        "nativescript-ui-chart": "~7.1.0",
        "nativescript-ui-dataform": "~6.0.0",
        "nativescript-ui-gauge": "~6.0.0",
        "nativescript-ui-listview": "~8.0.0",
        "nativescript-ui-sidedrawer": "~8.0.0",
        "reflect-metadata": "~0.1.12",
        "rxjs": "^6.4.0",
        "rxjs-compat": "~6.5.3",
        "tns-core-modules": "^6.5.5",
        "zone.js": "~0.9.1"
    },
    "devDependencies": {
        "@angular/compiler-cli": "8.2.4",
        "@ngtools/webpack": "^8.3.2",
        "@phenomnomnominal/angular-lazy-routes-fix": "^0.1.5",
        "codelyzer": "^5.2.0",
        "nativescript-dev-webpack": "^1.4.0",
        "node-sass": "^4.13.0",
        "prettier": "^1.19.0",
        "terser-webpack-plugin": "^2.3.0",
        "tns-platform-declarations": "^6.3.0",
        "tslint": "^5.20.0",
        "tslint-config-prettier": "^1.18.0",
        "typescript": "3.5.3",
        "uglifyjs-webpack-plugin": "^2.2.0",
        "webpack": "^4.41.0",
        "webpack-cli": "^3.3.0"
    }

Describe the bug

I’ve got Snapshot generation failed error and I tried to find out what is the problem. and

is related with android.text.style.MetricAffectingSpan…

ERROR in NativeScriptSnapshot. Snapshot generation failed!
Target architecture: armeabi-v7a


#
# Fatal error in , line 0
# ignored
#
#
#
#FailureMessage Object: 0xff8ad960
==== C stack trace ===============================

    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea7dbf) [0x574c5dbf]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea72d5) [0x574c52d5]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea276f) [0x574c076f]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xd00c6) [0x566ee0c6]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0xf7c3ae81]

JavaScript execution error: ReferenceError: android is not defined
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:90781:3)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:90836:30)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:139057:19)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:107223:35)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:107604:30)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:194350:28)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:119452:26)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:131959:19)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:132265:30)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:121773:25)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at Object.671 (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:249:131)
    at __webpack_require__ (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:110:30)
    at checkDeferredModules (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:79:23)
    at Array.webpackJsonpCallback [as push] (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:66:19)
    at Object.<anonymous> (/Users/sanghyunlee/Desktop/App/BAL/platforms/android/app/src/main/assets/app/_embedded_script_.js:282:58)
    at Module._compile (/Users/sanghyunlee/Desktop/App/BAL/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (/Users/sanghyunlee/Desktop/App/BAL/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at SnapshotGenerator.handleSnapshotToolResult (/Users/sanghyunlee/Desktop/App/BAL/node_modules/nativescript-dev-webpack/snapshot/android/snapshot-generator.js:349:13)
    at /Users/sanghyunlee/Desktop/App/BAL/node_modules/nativescript-dev-webpack/snapshot/android/snapshot-generator.js:444:40
    at ChildProcess.exithandler (child_process.js:310:5)
    at ChildProcess.emit (events.js:310:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:310:20)
    at Pipe.<anonymous> (net.js:672:12)$

To Reproduce

Expected behavior

Sample project

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 17 (11 by maintainers)

Most upvoted comments

I confirm same issue!

@dacalleg I suggest to delete package-lock.json, platforms, hooks and node_modules and should work. A said by @rigor789 you have to execute this: npm i --save @nativescript/core@6.5.9-rc-2020-07-04-159389-01

@dacalleg did you clean out platforms hooks and node_modules before rebuilding?

Also, try installing @nativescript/core too - as it defaults to the latest version and not the rc one. It’s also recommended to start using @nativescript/core instead of tns-core-modules.

npm i --save @nativescript/core@6.5.9-rc-2020-07-04-159389-01

@rigor789 If I use version you suggested everything works fine, I don’t have issue anymore. I’ll wait 6.5.9 version to adopt it.

Thanks very much.

Please test with @nativescript/core (or tns-core-modules if you are still using them) version 6.5.9-rc-2020-07-04-159389-01 and let me know if it works with it.

This is indeed an issue added in those commits. There should never be an android class reference directly at the top level of a file !

Can you try updating webpack and it’s config

@Ross-Olivares Thank you for your reply. yes, I removed snapshot-tools folder and it works now. but before fix this bug I will use a 6.5.0 version. thank you!

Sorry to answer in his place but I have already done this manipulation and it did not correct anything.

Hi @sanghyunj5958 Thank you for reporting this issue. We are going to try replicate this case on our end and will confirm. We will research what is causing this issue and will provide the needed fix. For further info, you could keep track the issue.

Meanwhile, can you remove snapshot-tools folder, restart and see if it work?

i have same issue with version 6.5.5

ERROR in NativeScriptSnapshot. Snapshot generation failed!
Target architecture: armeabi-v7a



#
# Fatal error in , line 0
# ignored
#
#
#
#FailureMessage Object: 0xffa3e950
==== C stack trace ===============================

    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea7dbf) [0x57489dbf]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea72d5) [0x574892d5]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xea276f) [0x5748476f]
    /app/tmp/mksnapshot-tools/v8-v8.0.426.16/linux-x64/mksnapshot-arm(+0xd00c6) [0x566b20c6]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0xf7bd2e81]

JavaScript execution error: ReferenceError: android is not defined

Downgrading to version 6.5.0 no more errors