java.lang.NullPointerException - Attempt to invoke virtual method 'android.view.ViewParent android.view.View.getParent()' on a null object reference
SergiOnGit opened this issue · 8 comments
MAX Module Version
5.0.2
React Native Version
0.71.6
Device/Platform Info
Android
Current Behavior
This happens mostly on android 13. If you put banner inside a view which has dynamical display style this error crashes the app. Not sure but I think this doesn't happen only with display style change, but even when phone orientation changes.
Expected Behavior
Not bugging even if I change display style.
How to Reproduce
Put banner inside view and toggle style display from none to flex.
Additional Info
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewParent android.view.View.getParent()' on a null object reference
at com.applovin.reactnative.AppLovinMAXNativeAdView.onLayoutChange(:2)
at android.view.View.layout(View.java:24992)
at android.view.ViewGroup.layout(ViewGroup.java:6784)
at com.facebook.react.uimanager.NativeViewHierarchyManager.updateLayout(NativeViewHierarchyManager.java:25)
at com.facebook.react.uimanager.NativeViewHierarchyManager.updateLayout(NativeViewHierarchyManager.java:90)
at com.facebook.react.uimanager.UIViewOperationQueue$UpdateLayoutOperation.execute(UIViewOperationQueue.java:27)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:135)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:53)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java)
at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:2)
at com.facebook.react.bridge.GuardedRunnable.run()
at android.os.Handler.handleCallback(Handler.java:942)
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:8757)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
@SergiOnGit, thanks for raising the issue. Is it possible for you to reproduce this with our demo app?
Also, you mentioned a banner, but your stack trace points out a native ad. Could you clarify that?
@alhiwatan Calling banner was a mistake. It is native banner. I will make a demo as soon as possible.
@alhiwatan Here you are:https://github.com/SergiOnGit/applovin-demo Just add you SDK key and banner id.
Happens during device orientation change. Tested on android 13, but I know it happens with other android versions too. Please prioritize this because it happens with almost every second user and this module is just useless now.
@SergiOnGit, thanks for sharing your demo app. I was able to run it but could not reproduce the issue. I kept rotating the device immediately after starting the app.
@SergiOnGit, thanks!!!. I got it on Android 13.
@alhiwatan I hope you will find the issue and fix it soon.
Fixed in latest version.