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

tns-core-modules + nativescript-advanced-webview + navigation is crashing the app #7901

Closed
NickIliev opened this issue Oct 3, 2019 · 2 comments · Fixed by #9148
Closed

Comments

@NickIliev
Copy link
Contributor

NickIliev commented Oct 3, 2019

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.1.2
  • Cross-platform modules: 6.1.1
  • Android Runtime: 6.1.x
  • Plugin(s): nativescript-advaced-webview@4.0.1

Describe the bug
Navigating to a page that contains BottomNavigation (or Tabs) + having nativescript-advanced-webview as a dependency (not even explicitly used/initialized) is crashing the app with:

System.err: An uncaught Exception occurred on "main" thread.
System.err: The specified child already has a parent. You must call removeView() on the child's parent first.
System.err:
System.err: StackTrace:
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:5034)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4865)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4805)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4778)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:887)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
System.err:     at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2656)
System.err:     at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2610)
System.err:     at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2619)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:904)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
System.err:     at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2076)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1866)
System.err:     at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1821)
System.err:     at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
System.err:     at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
System.err:     at android.os.Handler.handleCallback(Handler.java:873)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
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)

To Reproduce

Use this branch of the test app.

  • Navigate to the tabs page
  • press the second navigation button
  • return back to the tabs page

Result: the app will crash.
If you uninstall the nativescript-advanced-webview and make clean rebuild the issue will be gone.

Sample project
https://github.com/NativeScript/login-tab-navigation-ng/tree/niliev/bottom-nav-scenario

@NickIliev NickIliev added the bug label Oct 3, 2019
@NickIliev NickIliev changed the title BottomNavigation + nativescript-advanced-webview + navigation is crashing the app BottomNavigation/Tabs + nativescript-advanced-webview + navigation is crashing the app Oct 3, 2019
@NickIliev NickIliev added tabs and removed tab-view labels Oct 3, 2019
@tsonevn tsonevn added the backlog label Oct 9, 2019
@manoldonev
Copy link
Contributor

nativescript-advanced-webview internally depends on fancy-advanced-webview and the latter has a dependency on androidx.appcompat:appcompat:1.1.0-rc01 in its build.gradle that is causing the problem. Currently this scenario works only with androidx.appcompat:appcompat:1.0.0.

@NickIliev NickIliev changed the title BottomNavigation/Tabs + nativescript-advanced-webview + navigation is crashing the app tns-core-modules + nativescript-advanced-webview + navigation is crashing the app Oct 11, 2019
@manoldonev manoldonev removed their assignment Nov 23, 2019
@mitch3s
Copy link

mitch3s commented Dec 26, 2019

Hello, I have the same issue in an app with nativescript-material-components when routing from a page with BottomNavigation to another page and then back.

This plugin is using androidx.appcompat:appcompat:1.1.0

Is there any workaround aside from downgrading the appcompat dependency?

NathanWalker added a commit that referenced this issue Jan 17, 2021
rigor789 added a commit that referenced this issue Jan 20, 2021
* chore(release): @nativescript/core@7.1.1

* feat(core): rollup additional Utils

* fix(webpack): support other workspace config styles

* chore(release): @nativescript/core@7.1.2

* fix(android): BottomNavigation fragment child already has a parent (#9148)

closes #8132
closes #7901
closes #9051
closes #8251

* chore(release): @nativescript/core@7.1.3

* types: missing typings for iosIgnoreSafeArea (#9153)

* Update build-docs.sh

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>
Co-authored-by: Martin Guillon <martin.guillon@akylas.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants