ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

The specified child already has a parent. You must call removeView() on the child's parent first. #561

Closed rakeshgirase closed 5 years ago

rakeshgirase commented 6 years ago

Please take a minute to read our NativeScript Code of Conduct before proceeding with posting issues or discussing. The purpose of this guide is to make communication and cooperation within our forums a pleasure for you and the other members.

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow?

Yes

Tell us about the problem

Got Following exception in production. When checked, I came around an issue https://github.com/telerik/nativescript-ui-feedback/issues/128 which was closed but it seems the problem still exist. Exception java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. android.view.ViewGroup.addViewInner (ViewGroup.java:4312) android.view.ViewGroup.addView (ViewGroup.java:4148) android.view.ViewGroup.addView (ViewGroup.java:4089) android.view.ViewGroup.addView (ViewGroup.java:4062) android.app.FragmentManagerImpl.moveToState (FragmentManager.java:985) android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1148) android.app.BackStackRecord.run (BackStackRecord.java:799) android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:1537) android.app.FragmentManagerImpl$1.run (FragmentManager.java:482) android.os.Handler.handleCallback (Handler.java:742) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:157) android.app.ActivityThread.main (ActivityThread.java:5555) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:745) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:635)

Which platform(s) does your issue occur on?

_Android Android API: 23 Android OS: 6.0.1

Please provide the following version numbers that your issue occurs with:

Following is my key dependency from package.json "nativescript-exit": "^1.0.1", "nativescript-grid-view": "^3.3.2", "nativescript-plugin-firebase": "4.2.1", "nativescript-pro-ui": "^3.2.0", "nativescript-social-share": "^1.5.0", "nativescript-theme-core": "1.0.4", "nativescript-toast": "^1.4.6", "rxjs": "5.5.2", "tns-core-modules": "3.4.0"

Please tell us how to recreate the issue in as much detail as possible.

I am not sure how to recreate this issue. Surprisingly, I got this exception in production.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

No

NickIliev commented 6 years ago

@rakeshgirase which controls are used in your application - is it possible to provide a sample demo that can reproduce the issue in production?

rakeshgirase commented 6 years ago

Thank you for your response @NickIliev. My application can be found at https://github.com/rakeshgirase/QSB. I don't really have much details for reproducing this issue. I just got an email from Google highlighting this Fatal Issue. I have forwarded that email to you just in case if it helps.

NickIliev commented 6 years ago

@rakeshgirase I am not able to reproduce the issue - do you have any specific steps that I can follow to throw the error?

gsmedley commented 6 years ago

Same issue here. Started running monkey tests on our application. Usually after about 10/15 min we'll see this:

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:4656)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4492)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4433)
System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4406)
System.err:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
System.err:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1163)
System.err:     at android.app.BackStackRecord.run(BackStackRecord.java:793)
System.err:     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1552)
System.err:     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:487)
System.err:     at android.os.Handler.handleCallback(Handler.java:739)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
System.err:     at android.os.Looper.loop(Looper.java:158)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7224)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Versions:

    "@angular/common": "^4.4.5",
    "@angular/compiler": "^4.4.5",
    "@angular/core": "^4.4.5",
    "@angular/forms": "^4.4.5",
    "@angular/http": "^4.4.5",
    "@angular/platform-browser": "^4.4.5",
    "@angular/router": "^4.4.5",
    "@types/i18next": "^8.4.2",
    "angular": "^1.6.6",
    "bigdecimal": "^0.6.1",
    "i18next": "^9.1.0",
    "jsrsasign": "^8.0.4",
    "moment": "2.19.1",
    "nativescript-angular": "^4.4.0",
rakeshgirase commented 6 years ago

@NickIliev I too dont know how to produce that error. Thought of raising it just because I got this info from google.

VladimirAmiorkov commented 6 years ago

Hi @rakeshgirase ,

The https://github.com/telerik/nativescript-ui-feedback/issues/128 issue was related to the RadGauge component which I was not able to find to be used inside your app so I would guess this is not the same issue. Looking at what @gsmedley provided he is actually not using the nativescript ui components at all so this might be an issue with one of the tns-core-modules components. Al tho doing a random monkey test on an app for 15 minutes straight and after that getting an error may be an issue regarding GC in the android run time.

This needs to be research further so if you can provide any additional information please do so. @gsmedley can you share your app with is that you ran the monkey test on of possible?

gsmedley commented 6 years ago

Hi @VladimirAmiorkov,

Thanks for the reply. That wasn't a full list of the components we are using, I'll add that to the end of this message.

I can't share the app, it's an in-house application that relies on a private server. But I will share all of the results of my stress testing. Currently I am seeing 4 different crashes that happen within about 15/20 minutes

561 - This one.

#1048 - Related to using the back button with a "clearHistory" #1151 - Also related to the back button with a "clearHistory" OutOfMemory - This was with the graphing component, could be the app caching data, need to investigate further.

Full list of components. Note that I've excluded the custom components from the tests: nativescript-anyline, nativescript-idscanner & nativescript-medicalsensors.

 "dependencies": {
    "@angular/common": "^4.4.5",
    "@angular/compiler": "^4.4.5",
    "@angular/core": "^4.4.5",
    "@angular/forms": "^4.4.5",
    "@angular/http": "^4.4.5",
    "@angular/platform-browser": "^4.4.5",
    "@angular/router": "^4.4.5",
    "@types/i18next": "^8.4.2",
    "angular": "^1.6.6",
    "bigdecimal": "^0.6.1",
    "i18next": "^9.1.0",
    "jsrsasign": "^8.0.4",
    "moment": "2.19.1",
    "nativescript-angular": "^4.4.0",
    "nativescript-anyline": "file:plugins/nativescript-anyline",
    "nativescript-bcryptjs": "^1.0.1",
    "nativescript-bluetooth": "https://github.com/kanayo/nativescript-bluetooth/tarball/master",
    "nativescript-cardview": "^2.0.5",
    "nativescript-checkbox": "https://github.com/gsmedley/nativescript-checkbox-dist/tarball/master",
    "nativescript-floatingactionbutton": "^4.1.3",
    "nativescript-idscanner": "file:plugins/nativescript-idscanner",
    "nativescript-local-notifications": "https://github.com/kanayo/nativescript-local-notifications/tarball/master",
    "nativescript-medicalsensors": "file:plugins/nativescript-medicalsensors",
    "nativescript-ng2-fonticon": "^1.3.4",
    "nativescript-numeric-keyboard": "^3.0.3",
    "nativescript-permissions": "^1.2.3",
    "nativescript-secure-storage": "2.2.1",
    "nativescript-textinputlayout": "^2.0.2",
    "nativescript-texttospeech": "^2.0.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "1.4.6",
    "nativescript-ui-chart": "^3.5.0",
    "nativescript-ui-listview": "^3.5.0",
    "nativescript-ui-sidedrawer": "^3.5.0",
    "nativescript-unit-test-runner": "^0.3.4",
    "nativescript-urlhandler": "^1.2.1",
    "nativescript-uuid": "0.0.1",
    "npm": "^5.7.1",
    "object-assign-deep": "^0.3.1",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.4.2",
    "semver": "^5.5.0",
    "tns-core-modules": "^3.4.0",
    "tns-platform-declarations": "^3.3.0",
    "zone.js": "^0.8.18"
morzyns commented 6 years ago

The same here, it just happens randomly while navigating.

deps: "dependencies": { "@angular/animations": "~5.2.0", "@angular/common": "~5.2.0", "@angular/compiler": "~5.2.0", "@angular/core": "~5.2.0", "@angular/forms": "~5.2.0", "@angular/http": "~5.2.0", "@angular/platform-browser": "~5.2.0", "@angular/platform-browser-dynamic": "~5.2.0", "@angular/router": "~5.2.0", "crypto-js": "^3.1.9-1", "nativescript-angular": "~5.3.0", "nativescript-iqkeyboardmanager": "^1.3.0", "nativescript-nodeify": "^0.7.0", "nativescript-theme-core": "~1.0.4", "nativescript-ui-sidedrawer": "^4.0.0", "nativescript-websockets": "^1.4.0", "nativescript-webview-interface": "^1.4.2", "qs": "^6.5.1", "reflect-metadata": "~0.1.8", "rxjs": "~5.5.5", "tns-core-modules": "^4.0.0", "tns-platform-declarations": "~4.0.0", "zone.js": "~0.8.2" }, "devDependencies": { "@angular/compiler-cli": "~5.2.0", "@ngtools/webpack": "~1.9.4", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "clean-webpack-plugin": "~0.1.19", "copy-webpack-plugin": "~4.3.0", "css-loader": "~0.28.7", "extract-text-webpack-plugin": "~3.0.2", "lazy": "1.0.11", "nativescript-dev-sass": "^1.5.0", "nativescript-dev-typescript": "~0.7.0", "nativescript-dev-webpack": "^0.11.0", "nativescript-worker-loader": "~0.8.1", "raw-loader": "~0.5.1", "resolve-url-loader": "~2.2.1", "sass-loader": "~6.0.6", "typescript": "~2.7.2", "uglifyjs-webpack-plugin": "~1.1.6", "webpack": "~3.10.0", "webpack-bundle-analyzer": "^2.9.1", "webpack-sources": "~1.1.0" }

An uncaught Exception occurred on "main" thread. java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:4915) at android.view.ViewGroup.addView(ViewGroup.java:4746) at android.view.ViewGroup.addView(ViewGroup.java:4686) at android.view.ViewGroup.addView(ViewGroup.java:4659) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1281) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1549) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1611) at android.app.BackStackRecord.executeOps(BackStackRecord.java:807) at android.app.FragmentManagerImpl.executeOps(FragmentManager.java:2394) at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2189) at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2049) at android.app.FragmentManagerImpl$1.run(FragmentManager.java:718) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Tronix117 commented 6 years ago

I got the exact same issue with RadSideDrawer when resuming app and it is kind of really blocking for us.

Here is the layout (NS4+Vue)

(Don't mind the syntax)

RadSideDrawer(
  @loaded="loaded"
  height="100%" width="100%"
)
  Frame('~mainContent')
    component(:is="startingComponent" height="100%" width="100%")
  AbsoluteLayout('~drawerContent')
edusperoni commented 6 years ago

Yeah, I'm having the same issue. I just got the sidedrawer ng app template and added some components in one of the screens. If I press the back button repeatedly after navigating through the app a bit, this error appears

anuragd7 commented 6 years ago

I am experiencing the same error, interestingly also on android Api 23 version 6.0.1. I am running tns 3.4.2. Not using the drawer template though

Am reproducing the crashlytics log below:

Fatal Exception: java.lang.IllegalStateException
The specified child already has a parent. You must call removeView() on the child's parent first.

android.view.ViewGroup.addViewInnerandroid.view.ViewGroup.addViewInner (ViewGroup.java:4659)
android.view.ViewGroup.addView (ViewGroup.java:4495)
android.view.ViewGroup.addView (ViewGroup.java:4436)
android.view.ViewGroup.addView (ViewGroup.java:4409)
android.app.FragmentManagerImpl.moveToState (FragmentManager.java:996)
android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1164)
android.app.BackStackRecord.run (BackStackRecord.java:793)
android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:1557)
android.app.FragmentManagerImpl$1.run (FragmentManager.java:488)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:7331)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
ramoncardena commented 6 years ago

Same problem when navigating back in Android (randomly).

"dependencies": { "@angular/animations": "~6.1.0", "@angular/common": "~6.1.0", "@angular/compiler": "~6.1.0", "@angular/core": "~6.1.0", "@angular/forms": "~6.1.0", "@angular/http": "~6.1.0", "@angular/platform-browser": "~6.1.0", "@angular/platform-browser-dynamic": "~6.1.0", "@angular/router": "~6.1.0", "kinvey-nativescript-sdk": "^3.11.6", "nativescript-angular": "^6.1.0", "nativescript-camera": "^4.0.2", "nativescript-image-swipe": "^3.0.0", "nativescript-imagepicker": "^6.0.3", "nativescript-iqkeyboardmanager": "^1.3.0", "nativescript-localize": "^3.0.3", "nativescript-phone": "^1.3.1", "nativescript-theme-core": "~1.0.4", "nativescript-ui-dataform": "^3.6.1", "nativescript-ui-listview": "^3.5.5", "reflect-metadata": "~0.1.10", "rxjs": "^6.3.1", "tns-core-modules": "^4.2.0", "zone.js": "^0.8.26" }, "devDependencies": { "@angular/compiler-cli": "~6.1.0", "@ngtools/webpack": "~6.1.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "copy-webpack-plugin": "~4.5.1", "lazy": "1.0.11", "nativescript-dev-typescript": "^0.7.3", "nativescript-dev-webpack": "^0.15.1", "tns-platform-declarations": "^3.4.1", "typescript": "~2.7.2" }

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.addAddedFragments(FragmentManager.java:2407)
System.err:     at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186)
System.err:     at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)
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:172)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6590)
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)
System.err:     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
NickIliev commented 5 years ago

Closing as resolved via https://github.com/NativeScript/NativeScript/pull/6339

darkyelox commented 5 years ago

I'm having this problem now with NativeScript 6 + Angular in an Android 9 emulator, if i navigate to a view that have a Drawer and then i open a new page and go back this error pops up

limyandi commented 4 years ago

Closing as resolved via NativeScript/NativeScript#6339

Link shared is saying 404 not found, can you repost this fix?

itsmerockingagain commented 3 years ago

I am facing this issue when using bottom navigation component

itsmerockingagain commented 3 years ago

I'm having this problem now with NativeScript 6 + Angular in an Android 9 emulator, if i navigate to a view that have a Drawer and then i open a new page and go back this error pops up

@darkyelox how you have resoved this?