crash when calling createAdsLoader of ImaSdkFactory

181 views
Skip to first unread message

Chang Alex

unread,
Mar 11, 2016, 10:35:12 AM3/11/16
to Interactive Media Ads SDK
03-11 00:24:19.578 E/AndroidRuntime(11364): java.lang.NullPointerException: Attempt to read from field 'android.os.MessageQueue android.os.Looper.mQueue' on a null object reference
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.os.Handler.<init>(Handler.java:229)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.os.Handler.<init>(Handler.java:137)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.<init>(AwContentsClientCallbackHelper.java:94)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.<init>(AwContentsClientCallbackHelper.java:92)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at org.chromium.android_webview.AwContentsClientCallbackHelper.<init>(AwContentsClientCallbackHelper.java:153)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at org.chromium.android_webview.AwContentsClient.<init>(AwContentsClient.java:51)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at org.chromium.android_webview.AwContentsClient.<init>(AwContentsClient.java:46)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.android.webview.chromium.WebViewContentsClientAdapter.<init>(WebViewContentsClientAdapter.java:119)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:226)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.webkit.WebView.<init>(WebView.java:554)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.webkit.WebView.<init>(WebView.java:489)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.webkit.WebView.<init>(WebView.java:472)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.webkit.WebView.<init>(WebView.java:459)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at android.webkit.WebView.<init>(WebView.java:449)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.impl.y.<init>(IMASDK:37)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.impl.x.<init>(IMASDK:237)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.impl.g.<init>(IMASDK:239)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.impl.g.<init>(IMASDK:233)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:55)
03-11 00:24:19.578 E/AndroidRuntime(11364):     at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:47)

Please help.
Thanks
Alex

Vu Chau (IMA SDK Team)

unread,
Mar 11, 2016, 10:39:05 AM3/11/16
to Interactive Media Ads SDK
Hi Alex,

Which SDK version are you on?  Could you send us some sample code/minified project and the steps that can reproduce this issue?

Vu Chau
IMA SDK Team

Chang Alex

unread,
Mar 11, 2016, 10:56:47 AM3/11/16
to Interactive Media Ads SDK
Hi

I used the latest sdk.jar.

I cannot provide the project because it is not my personal project.

My flow is the following: User's Android application->JNI->our C++ engine->JNI->Google IMA SDK

When I tried other User's Android application codes, this flow did not have any issue. When I tried other user's, it generated this crash.

Thanks
Alex

Vu Chau (IMA SDK Team)

unread,
Mar 11, 2016, 12:10:54 PM3/11/16
to Interactive Media Ads SDK
Hi Alex,

Thanks for the info, but without any relevant code and insight into what the other components of the app are doing, it won't be possible for us to troubleshoot this crash.  
Make sure you are creating the AdsLoader as we guide in our docs

Vu Chau
IMA SDK Team

Chang Alex

unread,
Mar 11, 2016, 10:12:29 PM3/11/16
to Interactive Media Ads SDK
Hi Vu,

I found the root cause. This function needs to be called in the main thread. It seems that IMA SDK does not handle UI objects used in non-main thread. If IMA SDK document can mentioned this restriction, it will be better.

Thanks
Alex

Vu Chau (IMA SDK Team)

unread,
Mar 14, 2016, 10:52:02 AM3/14/16
to Interactive Media Ads SDK
Hi Alex,

That is correct.  In Android, UI objects are not thread-safe--they should only be updated on the main (which is why it's also called a UI) thread. 

You must do any UI-related work, such as configuring the AdsLoader to use a different language, on the main thread.  So, be sure to surface your UI objects to the main thread and do any update/manipulation on them there.  Failing to do so could cause your app to crash.

Vu Chau
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages