Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Back button breaks app on clearHistory: true (android) #1569

Closed
Daxito opened this issue Feb 17, 2016 · 23 comments · Fixed by #1637
Closed

Regression: Back button breaks app on clearHistory: true (android) #1569

Daxito opened this issue Feb 17, 2016 · 23 comments · Fixed by #1637
Assignees
Milestone

Comments

@Daxito
Copy link

Daxito commented Feb 17, 2016

So seems like if you have this scenario, the back button breaks the App, it can't navigate back any more, and it just crashes.

  1. Create an app using the new version 1.6.0
  2. Create Page1, Page2 and Page3
  3. Make Page1 you initial page, and add a button to navigate to Page2 like:
    var nav = { moduleName: "./Page2", backstackVisible: true, clearHistory: true }; frame.topmost().navigate(nav)
  4. In Page2, add another button to navigate to Page3, like:
    exports.toPage3 = function(){ frame.topmost().navigate("./Page3") }
  5. Once in Page3, try to navigate back using the "Back" button on your device, it just crashes, or you get a blank screen sometimes, I also attached a sample app if you want to use it.
    sampleapp.zip
    .
@Daxito
Copy link
Author

Daxito commented Feb 18, 2016

Wow, so am I the only one with this issue? I attached a sample with the issue, you can just run it and you will see. Using brand new project....

@NathanaelA

This comment was marked as abuse.

@Daxito
Copy link
Author

Daxito commented Feb 18, 2016

I know, after a release I myself face issues, I was just pinging :-)

@NathanaelA

This comment was marked as abuse.

@Daxito
Copy link
Author

Daxito commented Feb 18, 2016

Yes, easy to test. I know it is dificult to find and issue without some sample, I try to add a sample when possible.
Thank you @NathanaelA

@NathanaelA

This comment was marked as abuse.

@enchev
Copy link
Contributor

enchev commented Feb 19, 2016

Hey @slavchev, @hshristov can you help here?

@Louroj
Copy link

Louroj commented Feb 24, 2016

I'm also having this issue, any solutions so far?

I have tried to go back to 1.5.2 but without much success since it now displays some other errors that did not happen before.

@tiagordc
Copy link

Can we have this before 1.7.0? I have the same issue

@firecube
Copy link

+1

Also affected by this issue. In my app logging out takes you back to the login page and clears history. After logging back and navigating around the first use of the back button crashes the app.

Would be awesome to have this fixed before 1.7.

@ErjanGavalji
Copy link
Contributor

@Daxito, would you please, change the title to something a little bit shorter, so that it gets fine in the release notes?

For example:

Regression: Back button breaks app on clearHistory: true (android)

@Daxito Daxito changed the title Android: Back button breaks App when clearHistory: true using {N} 1.6.0, 1.5.2 was fine Regression: Back button breaks app on clearHistory: true (android) Feb 25, 2016
@vjoao
Copy link
Contributor

vjoao commented Feb 27, 2016

I'm also getting this same crash. Thing is I'm not even clearing the back history.
I think I have a even more weird case:

I navigate to page2 with

let navigationEntry = {
        moduleName : "select",
        context : {
            deferred: deferred
        }
};
topmost().navigate(navigationEntry);

And on the select page I have a button which calls topmost().goBack();. Sometimes, if I stay long enough on the select page I can't click the button anymore (It doesn't cause the app to go back to home). If I press the physical back button on Android, the app closes (literally and some seconds after it reopens with the error) and the error

java.lang.RuntimeException: Unable to destroy activity {org.nativescript.quedia/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-1216981224
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3739)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3757)
at android.app.ActivityThread.access$1500(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)

appears out of nowhere. Is this somehow related to this bug?

@GerjanOnline
Copy link

This bug hits me as well (v1.6.2) which is very annoying, please create a release with the fix asap if you want/can!

@NathanaelA

This comment was marked as abuse.

@orsag
Copy link

orsag commented Apr 29, 2016

I added clearHistory: true to one of my navigations and during navigation app crashed with error

android.content.res.Resources$NotFoundException: Resource ID #0xffffffec at android.content.res.Resources.getValue(Resources.java:1163) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2349) at android.content.res.Resources.getAnimation(Resources.java:1003) at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:71) at android.app.FragmentManagerImpl.loadAnimator(FragmentManager.java:744) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:959) at android.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1168) at android.app.BackStackRecord.run(BackStackRecord.java:641) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1450) at android.app.FragmentManagerImpl$1.run(FragmentManager.java:444) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5118) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606) at dalvik.system.NativeStart.main(Native Method)

Crashed on 1.7.1, everything works fine on 2.0.0-2016-04-27-549.

@jeremypele
Copy link

@orsag Did you remember what fixed it? I can't reproduce it on my side but I've got a whole bunch of sentry errors poppin with the very same stack trace on production

@john-e-riordan
Copy link

System.err: android.content.res.Resources$NotFoundException: Resource ID #0xffffffec
System.err:     at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:215)
System.err:     at android.content.res.Resources.loadXmlResourceParser(Resources.java:2134)
System.err:     at android.content.res.Resources.getAnimation(Resources.java:1167)
System.err:     at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:125)
System.err:     at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:106)
System.err:     at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:91)
System.err:     at android.app.FragmentManagerImpl.loadAnimator(FragmentManager.java:1089)
System.err:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1368)
System.err:     at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
System.err:     at android.app.BackStackRecord.executeOps(BackStackRecord.java:802)
System.err:     at android.app.FragmentManagerImpl.executeOps(FragmentManager.java:2386)
System.err:     at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2181)
System.err:     at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2136)
System.err:     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)
System.err:     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
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)

@jeremypele - I have same/similar issue in 3.4.1. Happened once randomly while developing, can't reproduce, and it is happening in the wild.

@john-e-riordan
Copy link

And this one which has a slightly different trace, but...

System.err: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
System.err: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:4937)
System.err: 	at android.view.ViewGroup.addView(ViewGroup.java:4768)
System.err: 	at android.view.ViewGroup.addView(ViewGroup.java:4708)
System.err: 	at android.view.ViewGroup.addView(ViewGroup.java:4681)
System.err: 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1284)
System.err: 	at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
System.err: 	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618)
System.err: 	at android.app.BackStackRecord.executeOps(BackStackRecord.java:807)
System.err: 	at android.app.FragmentManagerImpl.executeOps(FragmentManager.java:2386)
System.err: 	at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2181)
System.err: 	at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2136)
System.err: 	at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)
System.err: 	at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
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)

@john-e-riordan
Copy link

john-e-riordan commented Feb 14, 2018

@jeremypele

I believe I’ve tracked this one down after a lot of painful work to reproduce it.

TLDR; When the ExtendedNavigationOptions transition property is undefined, the crashes do not occur (or at least in that case I have yet to be able to reproduce them).

On Android as of 3.4.1 there appears to be a bug/issue in NativeScript routing extensions when using a transition. It eventually crashes. The crashes are hard to reproduce. It's not clear to me what the issue is, but perhaps it seems to have something to do with calling navigate() repeatedly (and seems likely related to something down in ui/frame). In my case, I'm calling navigate() repeatedly before a prior call to navigate() resolves, but I'm not sure if that's a requirement to cause a crash.

Calling navigate() repeatedly is legit and Angular handles it well, but NativeScript provides a custom LocationStrategy to the Angular router and guessing the issue is down in that direction someplace. Like eyeballing the code and using a bit of imagination it doesn't seem far fetched that there is some issue that crops up when calling navigate() repeatedly with transition = { name: "fade" } while there are outstanding calls to navigate() that have not resolved (for what is is worth, I was able to reproduce the crash consistently/eventually (stress eventually) using the "fade" transition but didn't try with any others). Like perhaps it is getting tripped up because NSLocationStrategy is storing a single reference to the current NavigationOptions which is getting over written on each call to navigate() regardless of there being prior calls to navigate() that have yet to be resolved? But not digging into it further, that's pure reckless speculation and I know enough to know I don't know the code involved well enough to have a real clue.

There doesn't seem to be an issue on iOS, thus the ui/frame speculation.

@sserdyuk
Copy link

@jeremypele @john-e-riordan I just got a crash report from Filebase production app with a similar stack. I have no idea on what triggered it, as it's a production app, and I only get Java stack, no TS. If you find anything worth trying, please ping me.

Exception android.content.res.Resources$NotFoundException: Resource ID #0xffffffec android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:202) android.content.res.Resources.loadXmlResourceParser (Resources.java:2968) android.content.res.Resources.getAnimation (Resources.java:2008) android.animation.AnimatorInflater.loadAnimator (AnimatorInflater.java:125) android.animation.AnimatorInflater.loadAnimator (AnimatorInflater.java:106) android.animation.AnimatorInflater.loadAnimator (AnimatorInflater.java:91) android.app.FragmentManagerImpl.loadAnimator (FragmentManager.java:827) android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1065) android.app.FragmentManagerImpl.removeFragment (FragmentManager.java:1280) android.app.BackStackRecord.run (BackStackRecord.java:766) android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:1582) android.app.FragmentManagerImpl$1.run (FragmentManager.java:483) android.os.Handler.handleCallback (Handler.java:751) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:154) android.app.ActivityThread.main (ActivityThread.java:6642) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)

@edusperoni
Copy link
Contributor

This issue is still present if you mash the back button. It seems to be happening if you press the back button during a transition.

@sserdyuk
Copy link

Might be related to #5657

@lock
Copy link

lock bot commented Aug 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.