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

Appcelerator JIRA | Federico Casali | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h3. Problem description Setting 'borderWidth' for a window in a tabGroup crashes the App Not reproducible with TiSDK 2.1.4 GA h3. Steps to reproduce: Start from the KitchenSink BaseUIWindow.js Add borderWidth: 0 in the self (window) definition as follows: {code} function BaseUIWindow(title) { var self = Ti.UI.createWindow({ title:title, backgroundColor:'white', borderWidth : 0 // Add this line }); {code} The app will crash in the simulator and on the device with the following error: {code} [1028,1028] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.0.0,2012/12/12 18:49,a5894b3 [ERROR][TiApplication(13705)] java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. [ERROR][TiApplication(13705)] at android.view.ViewGroup.addViewInner(ViewGroup.java:3337) [ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3208) [ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3188) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.initializeBorder(TiUIView.java:953) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:697) [ERROR][TiApplication(13705)] at ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49) [ERROR][TiApplication(13705)] at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:893) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:310) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:107) [ERROR][TiApplication(13705)] at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR][TiApplication(13705)] at android.os.Looper.loop(Looper.java:137) [ERROR][TiApplication(13705)] at android.app.ActivityThread.main(ActivityThread.java:4514) [ERROR][TiApplication(13705)] at java.lang.reflect.Method.invokeNative(Native Method) [ERROR][TiApplication(13705)] at java.lang.reflect.Method.invoke(Method.java:511) [ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) [ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) [ERROR][TiApplication(13705)] at dalvik.system.NativeStart.main(Native Method) {code}

    Appcelerator JIRA | 4 years ago | Federico Casali
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  2. 0

    h3. Problem description Setting 'borderWidth' for a window in a tabGroup crashes the App Not reproducible with TiSDK 2.1.4 GA h3. Steps to reproduce: Start from the KitchenSink BaseUIWindow.js Add borderWidth: 0 in the self (window) definition as follows: {code} function BaseUIWindow(title) { var self = Ti.UI.createWindow({ title:title, backgroundColor:'white', borderWidth : 0 // Add this line }); {code} The app will crash in the simulator and on the device with the following error: {code} [1028,1028] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.0.0,2012/12/12 18:49,a5894b3 [ERROR][TiApplication(13705)] java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. [ERROR][TiApplication(13705)] at android.view.ViewGroup.addViewInner(ViewGroup.java:3337) [ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3208) [ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3188) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.initializeBorder(TiUIView.java:953) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:697) [ERROR][TiApplication(13705)] at ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49) [ERROR][TiApplication(13705)] at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:893) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:310) [ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:107) [ERROR][TiApplication(13705)] at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR][TiApplication(13705)] at android.os.Looper.loop(Looper.java:137) [ERROR][TiApplication(13705)] at android.app.ActivityThread.main(ActivityThread.java:4514) [ERROR][TiApplication(13705)] at java.lang.reflect.Method.invokeNative(Native Method) [ERROR][TiApplication(13705)] at java.lang.reflect.Method.invoke(Method.java:511) [ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) [ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) [ERROR][TiApplication(13705)] at dalvik.system.NativeStart.main(Native Method) {code}

    Appcelerator JIRA | 4 years ago | Federico Casali
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  3. 0

    AlertDialog after AlertDialog

    Stack Overflow | 4 years ago | Styler2go
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

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

    Stack Overflow | 5 years ago | Kazekage Gaara
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  6. 0

    Android TextView in ScrollView not working- Force Close

    Stack Overflow | 5 years ago | Rekar
    java.lang.RuntimeException: Unable to start activity ComponentInfo{rg.ah/rg.ah.TutViewerActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Android Platform
    ViewGroup.addView
    1. android.view.ViewGroup.addViewInner(ViewGroup.java:3337)[TiApplication(13705)]
    2. android.view.ViewGroup.addView(ViewGroup.java:3208)[TiApplication(13705)]
    3. android.view.ViewGroup.addView(ViewGroup.java:3188)[TiApplication(13705)]
    3 frames
  3. org.appcelerator.titanium
    TiUIView.processProperties
    1. org.appcelerator.titanium.view.TiUIView.initializeBorder(TiUIView.java:953)[TiApplication(13705)]
    2. org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:697)[TiApplication(13705)]
    2 frames
  4. ti.modules.titanium
    TiView.processProperties
    1. ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49)[TiApplication(13705)]
    1 frame
  5. org.appcelerator.kroll
    KrollProxy.handleMessage
    1. org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:893)[TiApplication(13705)]
    1 frame
  6. org.appcelerator.titanium
    TiWindowProxy.handleMessage
    1. org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:310)[TiApplication(13705)]
    2. org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:107)[TiApplication(13705)]
    2 frames
  7. Android Platform
    ActivityThread.main
    1. android.os.Handler.dispatchMessage(Handler.java:95)[TiApplication(13705)]
    2. android.os.Looper.loop(Looper.java:137)[TiApplication(13705)]
    3. android.app.ActivityThread.main(ActivityThread.java:4514)[TiApplication(13705)]
    3 frames
  8. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)[TiApplication(13705)]
    2. java.lang.reflect.Method.invoke(Method.java:511)[TiApplication(13705)]
    2 frames
  9. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)[TiApplication(13705)]
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)[TiApplication(13705)]
    2 frames
  10. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame