Wayaer / fl_pip

flutter picture-in-picture plugin for ios and android
MIT License
27 stars 14 forks source link

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

Open pret-mohammadraghib opened 9 months ago

pret-mohammadraghib commented 9 months ago

Getting this error when calling FlPiP().toggle() or FlPip().disable method.

E/AndroidRuntime( 1442): java.lang.RuntimeException: Unable to pause activity {com.example.pip_poc/com.example.pip_poc.MainActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. E/AndroidRuntime( 1442): at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5609) E/AndroidRuntime( 1442): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5560) E/AndroidRuntime( 1442): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5512) E/AndroidRuntime( 1442): at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:239) E/AndroidRuntime( 1442): at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:210) E/AndroidRuntime( 1442): at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:192) E/AndroidRuntime( 1442): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140) E/AndroidRuntime( 1442): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101) E/AndroidRuntime( 1442): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2627) E/AndroidRuntime( 1442): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime( 1442): at android.os.Looper.loopOnce(Looper.java:257) E/AndroidRuntime( 1442): at android.os.Looper.loop(Looper.java:368) E/AndroidRuntime( 1442): at android.app.ActivityThread.main(ActivityThread.java:8821) E/AndroidRuntime( 1442): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 1442): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) E/AndroidRuntime( 1442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) E/AndroidRuntime( 1442): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. E/AndroidRuntime( 1442): at android.view.ViewGroup.addViewInner(ViewGroup.java:5380) E/AndroidRuntime( 1442): at android.view.ViewGroup.addView(ViewGroup.java:5201) E/AndroidRuntime( 1442): at android.view.ViewGroup.addView(ViewGroup.java:5168) E/AndroidRuntime( 1442): at com.fl.pip.FlPiPActivity$PiPPlugin.enableWM(FlPiPActivity.kt:240) E/AndroidRuntime( 1442): at com.fl.pip.FlPiPActivity$PiPPlugin.enable(FlPiPActivity.kt:166) E/AndroidRuntime( 1442): at com.fl.pip.FlPiPActivity$PiPPlugin.access$enable(FlPiPActivity.kt:58) E/AndroidRuntime( 1442): at com.fl.pip.FlPiPActivity$PiPPlugin$activityLifecycleCallbacks$1.onActivityPaused(FlPiPActivity.kt:356) E/AndroidRuntime( 1442): at android.app.Application.dispatchActivityPaused(Application.java:481) E/AndroidRuntime( 1442): at android.app.Activity.dispatchActivityPaused(Activity.java:1529) E/AndroidRuntime( 1442): at android.app.Activity.onPause(Activity.java:2522) E/AndroidRuntime( 1442): at io.flutter.embedding.android.FlutterActivity.onPause(FlutterActivity.java:812) E/AndroidRuntime( 1442): at android.app.Activity.performPause(Activity.java:8963) E/AndroidRuntime( 1442): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1676) E/AndroidRuntime( 1442): at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5599) E/AndroidRuntime( 1442): ... 15 more

pret-mohammadraghib commented 9 months ago

Geting black screen on IOs device, i am using enableWhenBackground config.

Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this. 2024-02-03 13:58:36.603912+0530 Runner[1123:198595] [BackgroundTask] Background Task 188 ("Flutter debug task"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.