Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Cannot read property 'obtainStyledAttributes' of undefined #105

Open
rg777 opened this issue Mar 8, 2019 · 1 comment
Open

Cannot read property 'obtainStyledAttributes' of undefined #105

rg777 opened this issue Mar 8, 2019 · 1 comment

Comments

@rg777
Copy link

rg777 commented Mar 8, 2019

The following error shows sometimes when I resume the app after closing it.
I have noticed that this error started showing after I introduced the "markingMode": "none". Are these correlated?

System.err: Calling js method onCreate failed
System.err: 
System.err: TypeError: Cannot read property 'obtainStyledAttributes' of undefined
System.err: File: "file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/nativescript-cardview/cardview.js, line: 36, column: 42
System.err: 
System.err: StackTrace: 
System.err: 	Frame: function:'CardView.(anonymous function)', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/nativescript-cardview/cardview.js', line: 36, column: 43
System.err: 	Frame: function:'applyAllNativeSetters', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/properties/properties.js', line: 960, column: 28
System.err: 	Frame: function:'initNativeView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/properties/properties.js', line: 904, column: 9
System.err: 	Frame: function:'ViewBase.onResumeNativeUpdates', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 626, column: 22
System.err: 	Frame: function:'ViewBase._resumeNativeUpdates', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 272, column: 18
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 531, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'ContentView.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/content-view/content-view.js', line: 70, column: 13
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'ContentView.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/content-view/content-view.js', line: 70, column: 13
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'ContentView.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/content-view/content-view.js', line: 70, column: 13
System.err: 	Frame: function:'PageBase.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/page/page-common.js', line: 126, column: 40
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'FrameBase.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/frame/frame-common.js', line: 368, column: 13
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
System.err: 	Frame: function:'RadSideDrawer.eachChildView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/nativescript-ui-sidedrawer/ui-sidedrawer.common.js', line: 144, column: 13
System.err: 	Frame: function:'ViewCommon.eachChild', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
System.err: 	Frame: function:'ViewBase._setupUI', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
System.err: 	Frame: function:'ViewBase._setupAsRootView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 479, column: 14
System.err: 	Frame: function:'ViewCommon._setupAsRootView', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 98, column: 43
System.err: 	Frame: function:'ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 940, column: 22
System.err: 	Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 768, column: 14
System.err: 	Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/com.learnhance.curio.debug/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err: 
System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: 	at android.os.Looper.loop(Looper.java:193)
System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err: 	at java.lang.reflect.Method.invoke(Native Method)
System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: Caused by: com.tns.NativeScriptException: 
System.err: Calling js method onCreate failed

The project dependencies are as follows:

"dependencies": {
    "@angular/animations": "^7.2.8",
    "@angular/common": "^7.2.8",
    "@angular/compiler": "^7.2.8",
    "@angular/compiler-cli": "^7.2.8",
    "@angular/core": "^7.2.8",
    "@angular/forms": "^7.2.8",
    "@angular/http": "^7.2.8",
    "@angular/platform-browser": "^7.2.8",
    "@angular/platform-browser-dynamic": "^7.2.8",
    "@angular/router": "^7.2.8",
    "@ngxs/store": "^3.4.2",
    "@types/browser-sync": "0.0.43",
    "nativescript-angular": "^7.2.2",
    "nativescript-appversion": "^1.4.1",
    "nativescript-cardview": "^3.1.1",
    "nativescript-feedback": "^1.3.7",
    "nativescript-loading-indicator": "^2.4.0",
    "nativescript-local-notifications": "^3.1.2",
    "nativescript-localstorage": "^2.0.0",
    "nativescript-orientation": "^2.2.1",
    "nativescript-plugin-firebase": "^8.0.0",
    "nativescript-snackbar": "^4.1.1",
    "nativescript-social-share": "^1.5.1",
    "nativescript-status-bar": "^1.1.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-sidedrawer": "^5.1.0",
    "nativescript-web-image-cache": "^4.2.6",
    "nativescript-youtubeplayer": "^3.0.1",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^6.4.0",
    "tns-core-modules": "^5.2.2",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@nativescript/schematics": "^0.5.1",
    "@ngtools/webpack": "^7.3.5",
    "codelyzer": "^4.5.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "^0.7.8",
    "nativescript-dev-webpack": "^0.20.2",
    "tns-platform-declarations": "^5.2.2",
    "tslint": "^5.13.1",
    "typescript": "^3.1.1"
  },
@Archez
Copy link

Archez commented Mar 29, 2021

From what I have gathered, the ripple property's setNative method for android attempts to use the foreground activity (application.android.foregroundActivity) which normally shouldn't be an issue, but from some digging, the foreground activity is not available to be used until after certain lifecycle events (NativeScript/NativeScript#5307).

In the case of my app and what I experienced, some system actions would cause the activity for my app to be reset/restarted (e.g. changing system device language with app running in background). Once the app was resumed, the set native method for ripple runs too early and the foreground activity isn't ready yet causing the crash.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants