mobile-sdk-android icon indicating copy to clipboard operation
mobile-sdk-android copied to clipboard

Fatal Exception: java.lang.RuntimeException java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'.

Open Bej-Technologies opened this issue 3 years ago • 9 comments

I am getting the following error from AppNexus:

Fatal Exception: java.lang.RuntimeException
java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {94ff67b} called on Looper (mqt_native_modules, tid 197) {3c0cc80}, FYI main Looper is Looper (main, tid 2) {94ff67b})

It happens when the user backgrounds the app. We have AppNexus implemented as a Native Module in React Native and I believe there is some request in AppNexus that gets run when the app is backgrounded on a thread that it's not allowed to which causes the crash. I am having a hard time finding the source of the issue though, what we use is MultiAdRequestListener to fetch the ads. Anyone has any idea of where the issue could be?

Bej-Technologies avatar Jan 24 '22 13:01 Bej-Technologies

Hi @Bej-Technologies , Please provide following details for us to look into it .

  1. Full Stacktrace
  2. Appnexus SDK version that you are using.
  3. Android Version

yrajshekhar avatar Feb 15 '22 11:02 yrajshekhar

Hi @yrajshekhar!

Stacktrace:

Fatal Exception: java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {4bbf924} called on Looper (mqt_native_modules, tid 263) {5da52b}, FYI main Looper is Looper (main, tid 2) {4bbf924})
       at android.webkit.WebView.checkThread(WebView.java:2615)
       at android.webkit.WebView.loadUrl(WebView.java:742)
       at com.iab.omid.library.appnexus.b.e.a(:30)
       at com.iab.omid.library.appnexus.b.e.a(:30)
       at com.iab.omid.library.appnexus.b.e.a(:12)
       at com.iab.omid.library.appnexus.publisher.AdSessionStatePublisher.a(:8)
       at com.iab.omid.library.appnexus.b.f.a(:30)
       at com.iab.omid.library.appnexus.a.d.d(:4)
       at com.iab.omid.library.appnexus.a.d.onChange(:15)
       at android.database.ContentObserver.onChange(ContentObserver.java:153)
       at android.database.ContentObserver.onChange(ContentObserver.java:169)
       at android.database.ContentObserver.onChange(ContentObserver.java:187)
       at android.database.ContentObserver.onChange(ContentObserver.java:202)
       at android.database.ContentObserver.lambda$dispatchChange$0$ContentObserver(ContentObserver.java:282)
       at android.database.ContentObserver$$ExternalSyntheticLambda0.run(:10)
       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 com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
       at java.lang.Thread.run(Thread.java:920)

AppNexus SDK version: com.appnexus.opensdk:appnexus-sdk:[7,8)

Android versions are very spread out, see attached screenshot. Screenshot 2022-03-03 at 16 33 11

Bej-Technologies avatar Mar 03 '22 15:03 Bej-Technologies

Hi @Bej-Technologies, We are unable to replicate on our end. Please share the replication steps along with sample application to replicate the issue.

yrajshekhar avatar Apr 21 '22 08:04 yrajshekhar

@yrajshekhar I managed to reproduce it now, it crashes when I press the volume up/down button. Any ideas why that can be?

Bej-Technologies avatar May 12 '22 14:05 Bej-Technologies

I'm also trying to fork the library to edit it myself but the build seems to fail? https://jitpack.io/com/github/appnexus/mobile-sdk-android/7.21/build.log

Bej-Technologies avatar May 12 '22 14:05 Bej-Technologies

Ping @yrajshekhar

Bej-Technologies avatar May 17 '22 09:05 Bej-Technologies

I did some downgrading to see if I could get rid of the issue with older versions of your library and it seems like on version 7.13.1 it starts working. But version 7.14 and up I experience this issue

Bej-Technologies avatar May 17 '22 11:05 Bej-Technologies

I am getting the following error from AppNexus:

Fatal Exception: java.lang.RuntimeException
java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {94ff67b} called on Looper (mqt_native_modules, tid 197) {3c0cc80}, FYI main Looper is Looper (main, tid 2) {94ff67b})

It happens when the user backgrounds the app. We have AppNexus implemented as a Native Module in React Native and I believe there is some request in AppNexus that gets run when the app is backgrounded on a thread that it's not allowed to which causes the crash. I am having a hard time finding the source of the issue though, what we use is MultiAdRequestListener to fetch the ads. Anyone has any idea of where the issue could be?

@Bej-Technologies Going back to initial issue raised here, could you confirm that this issue arises only for MultiAdRequest. Maybe try using just BannerAdView / NativeAdRequest and see if you are able to replicate the issue with it as well. This will help us narrow down the issue to a certain implementation.

Also, we have upgraded the OMID, can you test your implementation with the latest SDK version, and let us know if the issue is still there.

avohraa avatar Oct 13 '22 13:10 avohraa

@Bej-Technologies were you able to test the above-mentioned scenarios? We are waiting for your response on it, to proceed further on our investigation.

avohraa avatar Nov 14 '22 14:11 avohraa

We are closing this issue due to inactivity. In case the issue persists, please feel free to reach out Xandr support.

avohraa avatar Nov 30 '22 14:11 avohraa