Fix Crash caused by TransactionTooLargeException in InterstitialAd.show()

Fix Crash caused by TransactionTooLargeException in InterstitialAd.show()
Photo by Tomáš Malík / Unsplash

The issue since happened a few years back since 2019. as time went by, in 2024, I still faced this issue while testing my android app release version.

535   866 E ActivityTaskManager: Second failure launching com.lengerrong.coca/com.google.android.gms.ads.AdActivity, giving up
05-15 03:12:28.066   535   866 E ActivityTaskManager: android.os.TransactionTooLargeException: data parcel size 537904 bytes
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at android.os.BinderProxy.transactNative(Native Method)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at android.os.BinderProxy.transact(BinderProxy.java:571)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at android.app.IApplicationThread$Stub$Proxy.scheduleTransaction(IApplicationThread.java:2732)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at android.app.servertransaction.ClientTransaction.schedule(ClientTransaction.java:136)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at com.android.server.wm.ClientLifecycleManager.scheduleTransaction(ClientLifecycleManager.java:47)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at com.android.server.wm.ActivityTaskSupervisor.realStartActivityLocked(ActivityTaskSupervisor.java:868)
05-15 03:12:28.066   535   866 E ActivityTaskManager:   at com.android.server.wm.RootWindowContainer.startActivityForAttachedApplicationIfNeeded(RootWindowContainer.java:1950)

it seems like there are some data size limit while start activity via Intent and passing some extras. I searched on google, not able to see any way to increase the size, that seems like bind to android SDK. and Google Admob SDK team still not provided any fix either.

With tests ad unit ids, everything works fine. I am not sure what will happen if release into production, since I donèt have a android device handy to do the test.

Edit Ad unit type, Remove video

I am thinking the issue is due to size limit, for the Ad content, it might consist of Text, image, and rich media and Video. Video elements might take big media buffer size. so I tried remove it and it works.

In you admob account dashboard, open your App, edit the ad unit that might cause the issue. Edit the ad unit type, not select video or remove video and save the change.

remove video

remove video

Though you might see warning: "Limiting ad types may result in decreased revenue", App stable is more important than AD revenue. because if your App always crash, then you will get zero.

Crash caused by TransactionTooLargeException in InterstitialAd.show()

Subscribe to Post, Code and Quiet Time.

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe