Repository navigation
tns-core-modules + nativescript-advanced-webview + navigation is crashing the app #7901
Copy link
Copy link
Closed
Description
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): [email protected]
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
Reacted by darkyelox
Activity
[-]BottomNavigation + nativescript-advanced-webview + navigation is crashing the app[/-][+]BottomNavigation/Tabs + nativescript-advanced-webview + navigation is crashing the app[/+]manoldonev commentedon Oct 10, 2019
nativescript-advanced-webview internally depends on fancy-advanced-webview and the latter has a dependency on
androidx.appcompat:appcompat:1.1.0-rc01in its build.gradle that is causing the problem. Currently this scenario works only withandroidx.appcompat:appcompat:1.0.0.[-]BottomNavigation/Tabs + nativescript-advanced-webview + navigation is crashing the app[/-][+]tns-core-modules + nativescript-advanced-webview + navigation is crashing the app[/+]mitch3s commentedon 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?
fix(android): BottomNavigation fragment child already has a parent
fix(android): BottomNavigation fragment child already has a parent (#…
ci: fix npm_install for core on CI (docs) (#9155)