infobip / mobile-messaging-sdk-android

Mobile Messaging SDK for Android
Apache License 2.0
51 stars 17 forks source link

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

Closed finchatticus closed 4 years ago

finchatticus commented 4 years ago

When using version 3.0.2 I'm getting an exception when sending multiple pushes.

Stacktrace:

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:4937)
        at android.view.ViewGroup.addView(ViewGroup.java:4768)
        at android.view.ViewGroup.addView(ViewGroup.java:4740)
        at androidx.appcompat.app.AlertController.setupCustomContent(AlertController.java:657)
        at androidx.appcompat.app.AlertController.setupView(AlertController.java:475)
        at androidx.appcompat.app.AlertController.installContent(AlertController.java:233)
        at androidx.appcompat.app.AlertDialog.onCreate(AlertDialog.java:279)
        at android.app.Dialog.dispatchOnCreate(Dialog.java:403)
        at android.app.Dialog.show(Dialog.java:302)
        at org.infobip.mobile.messaging.interactive.inapp.view.InAppViewDialog.showOnUiThread(InAppViewDialog.java:117)
        at org.infobip.mobile.messaging.interactive.inapp.view.InAppViewDialog.showOnUiThreadWithAppTheme(InAppViewDialog.java:80)
        at org.infobip.mobile.messaging.interactive.inapp.view.InAppViewDialog.access$000(InAppViewDialog.java:23)
        at org.infobip.mobile.messaging.interactive.inapp.view.InAppViewDialog$1.run(InAppViewDialog.java:63)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
tjuric commented 4 years ago

Hi @finchatticus, Could you tell us if you've used some different version of SDK before which didn't have this issue?

Is your app in foreground when you get these errors (per logs I'd say yes)? I guess messages that you're sending are configured to be displayed in-app as well. Could you confirm that?

When you say that it happens when you send multiple pushes, do you refer to the app staying in the same state (foreground, background) while these pushes are received or states change? Also, if I understood you correctly, you don't have this issue when you send single notification, can you confirm this?

Regards, Tereza

finchatticus commented 4 years ago

Could you tell us if you've used some different version of SDK before which didn't have this issue? Before I'm using 2.4.2 and issue does not appear

Is your app in foreground when you get these errors (per logs I'd say yes)? I don't know

I guess messages that you're sending are configured to be displayed in-app as well. Could you confirm that? Yes I send in app notifications

When you say that it happens when you send multiple pushes, do you refer to the app staying in the same state (foreground, background) while these pushes are received or states change? states change

Also, if I understood you correctly, you don't have this issue when you send single notification, can you confirm this? Yes when send a single notification bug does not appear, but when I send multiple notifications second time after crashing, bug doesn't appear too.

tjuric commented 4 years ago

@finchatticus, we will soon release a bugfix and notify you here.

tjuric commented 4 years ago

We've released version 3.0.3 that should have a fix for mentioned bug.

@finchatticus, please check it and notify us if there are no more issues.

tjuric commented 4 years ago

Closing this issue as we've provided bugfix version. @finchatticus, please reopen it if you notice this bug once again.

BR, Tereza