Repository navigation
Milestone
Description
From @tsonevn on August 9, 2018 6:18
From @vtrifonov on August 8, 2018 15:7
From @ludcila on August 8, 2018 14:21
Please, provide the details below:
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
Yes
Found some similar issues:
- Android listview error: There is no entry with key in the realized views cache ProgressNS/nativescript-ui-feedback#741
- https://stackoverflow.com/questions/50901650/nativescript-list-view-crash-using-android
Tell us about the problem
The app crashes when:
- Using a ListView with multiple templates
- There is a model update that causes an item to switch from one template to another
- The app is put into background and/or navigation occurs (using slide transition)
Please provide the following version numbers that your issue occurs with:
- CLI: 4.1.2
- Cross-platform modules: 4.1.1
- Runtime(s): 4.1.3
This seems to happen only on Android 8.0.
Did the error happen while the app was being constructed? (buildtime error)
No
Did the error happen while the app was executing? (runtime error)
Yes
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method getView failed
Error: There is no entry with key 'org.nativescript.widgets.StackLayout{4b534d0 V.E...... ........ 0,-133-1080,28}' in the realized views cache for template with key'visited'.
File: "file:///data/data/org.nativescript.nsissue741/files/app/tns_modules/tns-core-modules/ui/list-view/list-view.js, line: 241, column: 20
StackTrace:
Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.nsissue741/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 1298, column: 33
Frame: function:'ListViewAdapter.getView', file:'file:///data/data/org.nativescript.nsissue741/files/app/tns_modules/tns-core-modules/ui/list-view/list-view.js', line: 241, column: 27
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:983)
at com.tns.Runtime.callJSMethod(Runtime.java:970)
at com.tns.Runtime.callJSMethod(Runtime.java:954)
at com.tns.Runtime.callJSMethod(Runtime.java:946)
at com.tns.gen.android.widget.BaseAdapter_view_195_32_ListViewAdapter.getView(BaseAdapter_view_195_32_ListViewAdapter.java:52)
at android.widget.AbsListView.obtainView(AbsListView.java:2428)
at android.widget.ListView.makeAndAddView(ListView.java:2083)
at android.widget.ListView.fillUp(ListView.java:829)
at android.widget.ListView.fillGap(ListView.java:766)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5520)
at android.widget.ListView.trackMotionScroll(ListView.java:1991)
at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3660)
at android.widget.AbsListView.onTouchMove(AbsListView.java:4086)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3904)
at android.view.View.dispatchTouchEvent(View.java:11788)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2647)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:549)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1953)
at android.app.Activity.dispatchTouchEvent(Activity.java:3548)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:502)
at android.view.View.dispatchPointerEvent(View.java:12027)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5278)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5067)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4634)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4600)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4727)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4608)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4784)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4634)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4600)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4608)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4581)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7169)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7143)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7104)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7325)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:181)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7248)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7353)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)
at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:715)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Please tell us how to recreate the issue in as much detail as possible.
Sample project to reproduce the issue:
https://github.com/ludcila/ns-listview-issue
Copied from original issue: NativeScript/android#1145
Copied from original issue: #6166
Copied from original issue: NativeScript/nativescript-angular#1479
Activity
NickIliev commentedon Sep 20, 2018
From @tsonevn on August 9, 2018 6:18
Hi @ludcila,
Thank you for the provided sample project.
I tested it on my side and was able to recreate the problem. I will mark this as a bug. For now, I would suggest, to keep track of the issue for further info.
NickIliev commentedon Sep 20, 2018
From @psrcek on August 24, 2018 12:43
Can confirm this, occurs when an item switches templates while not on screen.
tns --version: 4.2.2package.json:
NickIliev commentedon Sep 20, 2018
From @bachras on September 12, 2018 9:35
I am having same issue as @psrcek
NickIliev commentedon Sep 20, 2018
Reproducible with this Playground when tapping on the item at 0 index.
edusperoni commentedon Oct 6, 2018
I've managed to pinpoint this error (beware spaghetti code):
https://play.nativescript.org/?template=play-js&id=h0dxyU&v=29
if you use a function as selector, it works as intended, if you don't you'll se that the bindingcontext used is not updating immediatly, but rather a "tick" later:
For some reason, "expression" is being evaluated later (shouldn't it be synchronous?). I believe this only happens to the first element because it's the first element to be checked after refresh is called (which, again is called in the same "tick" as the change). This can be confirmed by the following sequence of events:
Working as Intended:
Bad behavior:
When this happens, the view is cached in the wrong array key and whatever you do next will likely cause the crash. By the time the next refresh happens, the binding is updated, and it'll try to search for a green view (since it haven't changed color) in the now updated red template key.
edusperoni commentedon Oct 6, 2018
Additional info:
When you tap the SECOND item:
bindingContextChangetriggers for 1st and 2nd, even if 1st hasn't changedWhen you tap the FIRST item:
bindingContextChangetriggers for 2nd, but not for 1stSomething is preventing this event from being triggered, but I can't find out what.
https://play.nativescript.org/?template=play-js&id=h0dxyU&v=31
In the example, I'm manually triggering a bindingContextChange event just before querying the item template. which makes the listview work flawlessly.
if you comment:
you can check the current behavior (the logs will show you that after the "mudou" console line, which indicates the change has been made, the binding context event is not triggered for the first item).
I couldn't find where the bindingContextChange event is triggered, so I couldn't progress any further.
14 remaining items
spstratis commentedon Jan 17, 2020
@NathanaelA Thanks for the feedback! We weren't upgrading due to concerns around plugin support, a lot seemed to have moved behind a paywall in order to get the 6.x updates. It does seem with the newer version of 6.x they introduced a migrate function into the CLI that may help with the transition. We're just not at a point right now where we feel we can comfortably upgrade and still test everything out before our release date.
NathanaelA commentedon Jan 17, 2020
flodaniel commentedon Oct 16, 2020
hey,
@NathanaelA a lot has changed since this discussion but I am still seeing this issue on NS 6 with Angular.
Those are my versions:
Do you have an update on this, or a new possible solution?
StackTrace:
NathanaelA commentedon Oct 16, 2020
flodaniel commentedon Oct 19, 2020
not really. we still did not find a way to reliable trigger it within our app.
But we are using a rather complex setup where we have a nativescript-carousel and each CarouselItem contains one ListView.
Maybe we can find the time to reproduce it.
nikoTM commentedon Oct 23, 2020
I can confirm this still happens on NS7. I can see it happens in production via logs, but I am unable to reproduce it yet.
EDIT:
@NickIliev the PR that closed this issue might have solved one of the potential causes, but I can see it still happening on
@nativescript/core@7.0.12, the issue should be reopened. Interestingly enough it wasn't happening for us on 6.x, but after the upgrade I can see a lot of crashes with that error. And I am unable to reproduce.edusperoni commentedon Nov 6, 2020
I've reopened this issue as I have identified this still happens on very rare occasions where the items where updated while the view is in a suspended state (different page, app on background, screen turned off...).
I've identified the issue and should open a PR shortly to address it.
nikoTM commentedon Nov 11, 2020
Pointing to:
NativeScript/packages/core/ui/list-view/index.android.ts
Line 306 in 05faa86
Pointing to:
NativeScript/packages/core/ui/list-view/index.android.ts
Line 41 in 05faa86
I get a lot of these errors in the logs.
owner._realizedTemplates.get(template.key)returnsundefinednikoTM commentedon Nov 11, 2020
@hamorphis do you by chance remember the reasoning behind this line https://github.com/NativeScript/NativeScript/blob/6.5.19/nativescript-core/ui/list-view/list-view.android.ts#L287 why does it have to throw instead of creating a new view with
template.createView()?vicmasa commentedon Mar 3, 2021
Hello everyone.
These problems also happen to me frequently. Even updating to the latest version 7.x of Nativescrip.
Hope we can solve this problem together. I have been suffering from this type of bugs for 4 years, and I can not find the solution.
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method getView failed
System.err: Error: There is no entry with key 'org.nativescript.widgets.StackLayout{592520a V.E...... ........ 0,-445-1440,46}' in the realized views cache for template with key'image'.
System.err:
System.err: StackTrace:
System.err: ListViewAdapter.getView(file: node_modules/@nativescript/core/ui/list-view/list-view.android.js:243:0)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err: at com.tns.gen.android.widget.BaseAdapter_vendor_28514_32_ListViewAdapter.getView(BaseAdapter_vendor_28514_32_ListViewAdapter.java:39)
System.err: at android.widget.AbsListView.obtainView(AbsListView.java:2365)
System.err: at android.widget.ListView.makeAndAddView(ListView.java:2052)
System.err: at android.widget.ListView.fillUp(ListView.java:820)
System.err: at android.widget.ListView.fillGap(ListView.java:759)
System.err: at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5225)
System.err: at android.widget.ListView.trackMotionScroll(ListView.java:1971)
System.err: at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3574)
System.err: at android.widget.AbsListView.onTouchMove(AbsListView.java:3983)
System.err: at android.widget.AbsListView.onTouchEvent(AbsListView.java:3808)
System.err: at android.view.View.dispatchTouchEvent(View.java:11776)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2962)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2643)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
System.err: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
System.err: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:448)
System.err: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1829)
System.err: at android.app.Activity.dispatchTouchEvent(Activity.java:3307)
System.err: at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
System.err: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:410)
System.err: at android.view.View.dispatchPointerEvent(View.java:12015)
System.err: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4795)
System.err: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4609)
System.err: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
System.err: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
System.err: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
System.err: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293)
System.err: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
System.err: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350)
System.err: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
System.err: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
System.err: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
System.err: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
System.err: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
System.err: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6661)
System.err: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6635)
System.err: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6596)
System.err: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6764)
System.err: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186)
System.err: at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
System.err: at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:177)
System.err: at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6735)
System.err: at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6787)
System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:723)
System.err: at android.view.Choreographer.doFrame(Choreographer.java:652)
System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
System.err: at android.os.Handler.handleCallback(Handler.java:790)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:164)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
edusperoni commentedon Mar 3, 2021
@vicmasa I'm positive that you are not in the latest 7.x Nativescript version as this regression (not the same bug as 4 years ago) was fixed in 7.1 and that error message is no longer in the codebase, so it's not possible for it to show on >=7.1.0
vicmasa commentedon May 1, 2021
Hello everyone, the problem occurs whenever you have a listView with several components inside. I hope you can help us. Thanks.
An uncaught Exception occurred on "main" thread.
Calling js method getView failed
Error: There is no entry with key 'org.nativescript.widgets.GridLayout{54a6698 V.E...... ........ 0,-313-1080,27}' in the realized views cache for template with key'title'.
StackTrace:
ListViewAdapter.getView(file:///data/data/org.invianinternational.ViiAManager/files/app/vendor.js:28612:27)
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
at com.tns.Runtime.callJSMethod(Runtime.java:1160)
at com.tns.Runtime.callJSMethod(Runtime.java:1138)
at com.tns.Runtime.callJSMethod(Runtime.java:1134)
at com.tns.gen.android.widget.BaseAdapter_vendor_28566_32_ListViewAdapter.getView(BaseAdapter_vendor_28566_32_ListViewAdapter.java:39)
at android.widget.AbsListView.obtainView(AbsListView.java:2494)
at android.widget.HwAbsListView.obtainView(HwAbsListView.java:1139)
at android.widget.ListView.makeAndAddView(ListView.java:2119)
at android.widget.ListView.fillUp(ListView.java:853)
at android.widget.ListView.fillGap(ListView.java:785)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5646)
at android.widget.ListView.trackMotionScroll(ListView.java:2013)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:5152)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1057)
at android.view.Choreographer.doCallbacks(Choreographer.java:875)
at android.view.Choreographer.doFrame(Choreographer.java:772)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1042)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
phenric commentedon Oct 15, 2021
Hi everyone,
I'm also facing this issue on some phones. I tried to live debug on all the phones I can easily access but none of them has this issue.
I only have some logs from the store returned by the affected users.
I build the app with @nativescript/android v. 8.0.0.
Any news or idea on what could be the cause?
Did you fix it on your own projects?
Thx for your passion and your time!