Crash in libwebviewchromium.so and admob interstitial

I know there is another thread from back in 2018, but the solutions proposed in there did not work and I do have the same issue. It seems related to interstitial with admob on Android 4.4.x devices.

I tried removing hardware acceleration in the android manifest but crash is still present:

I am using the version com.google.android.gms:play-services-ads:15.0.1.

I tried the latest version but it crashes at application launch, so I did not continue on that path.

One of the person in that thread proposed to remove the advertisement all-together for the 4.4.x devices. This is a last resort, however, there are no Cocos2d command to retrieve the API level (from what I could find at least).

So I am kinda stuck with the app crashing quite a lot on the 4.4.x devices. Any suggestions?

Can’t you simply add a new java method, and call it from your C++ code? You should be able to check for one of these two:

android.os.Build.VERSION.RELEASE, which returns something like 4.4.0, and you can parse that to decide what to show.

android.os.Build.VERSION.SDK_INT, which should also work well, but it was introduced around Android 4, so check if it’s the right one for you to use. More info https://developer.android.com/reference/android/os/Build.VERSION#SDK_INT and https://stackoverflow.com/questions/3423754/retrieving-android-api-version-programmatically.

2 Likes

This was my last resort yes. However I don’t like modifying the core of cocos2d, it makes it harder to follow changes later, specially for a patch like that.

Was hoping someone had an actual fix

You don’t need to modify the Cocos2d-x engine to add Java code. Just add the code in [your project]/proj.android/app/src.

Thanks, I’ll do that.