Crash when attempting to show the same native ad in the same fragment
zeoflow-dev opened this issue · 2 comments
When the NativeAdView
is added multiple times in the same fragment that implements the same ad and adbinder crashes.
TODO: check if it crashes when we apply different implementations
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:6084)
at android.view.ViewGroup.addView(ViewGroup.java:5903)
at android.view.ViewGroup.addView(ViewGroup.java:5843)
at android.view.ViewGroup.addView(ViewGroup.java:5815)
at dev.teogor.ceres.ads.view.NativeAdView.addAd(NativeAdView.kt:115)
at dev.teogor.ceres.ads.view.NativeAdView.prepNativeAd$lambda-0(NativeAdView.kt:79)
at dev.teogor.ceres.ads.view.NativeAdView.$r8$lambda$xEyKj0WPgw_LDaJKFeGv9QmCnFU(Unknown Source:0)
at dev.teogor.ceres.ads.view.NativeAdView$$ExternalSyntheticLambda0.onChanged(Unknown Source:6)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
at androidx.lifecycle.LiveData$1.run(LiveData.java:93)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
when attached different bindings it also crashes
Issue Description Update Due to Repository Changes 🚧
Description ✏️:
During the beta phase of development, this issue was created to address specific functionality within the repository structure. However, since then, there have been significant changes to the repository's architecture and organization. As a result, the context and relevance of this issue have evolved.
Given the updated repository structure, the original problem or feature addressed by this issue may no longer be applicable or aligned with the current development goals. 🚩 Consequently, the issue needs to be reviewed and potentially redefined to match the revised project scope.
To maintain a clear and accurate issue tracking process, it is recommended to reevaluate the objectives and requirements associated with this issue in light of the new repository structure. 🔎 If the issue is no longer relevant or can be resolved through the updated architecture, it should be closed with appropriate comments explaining the decision.
The development team is encouraged to collaborate and communicate effectively during this evaluation process to ensure that all changes are documented, understood, and aligned with the project's goals.
Thank you for your understanding and cooperation in maintaining an organized and up-to-date repository. 🙌