Fatal error Targeting S+ (version 31 and above)

I have a very simple application that performs very simple calculation and reads simple JSON data from the Internet. Here are the android settings:
engine name=“android” spec=“11.0.0”
preference name=“android-minSdkVersion” value=“25”
preference name=“android-targetSdkVersion” value=“34”

It uses the following plugins:
cordova-plugin-splashscreen
cordova-plugin-buildinfo
cordova-plugin-device
cordova-plugin-globalization
cordova-plugin-device-orientation
cordova-plugin-network-information
cordova-plugin-whitelist
cordova-plugin-admobpro
cordova-plugin-appversion

and has no special settings, features, etc. It works perfectly on older phones, but when we test it on the newer ones we get the error:

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Any idea how to fix this issue?
Thanks

Does using android engine 12.0.1 produce different results?

Unfortunately the same result, also the same when I removed the engine name=“android”… line completely

I just discovered that if I remove cordova-plugin-admobpro the error is gone. The bad news is that I really need that plugin :slight_smile:
This is how it is specified in config.xml
<plugin name="cordova-plugin-admobpro" spec="*" />
Maybe I need to add a version or source??
Any help is welcomed
Thanks

Can you share a build log from your project? Is this error happening during build or runtime?

It happens on runtime, and I got some kind of report only once, but did not save it :frowning:
I’ll try to replace admobpro with some other admob plugin and see what will happen

Unfortunately replacing
<plugin name="cordova-plugin-admobpro" spec="*" />
with
<plugin name="admob-plus-cordova" spec="*" />
did not change anything

Does anyone have a working example that uses any kind of admob plugin with Volt and these settings:
<preference name=“android-minSdkVersion” value=“25”/>
<preference name=“android-targetSdkVersion” value=“34”/>
Thanks

What happens if you target SDK 33 and remove the minSdkVersion?

It still does not work, same behavior. I do not know if the error is the same, because there’s no report, but I guess it is the same.

If you have a complete traceback from the error it might be possible to diagnose the problem further.

This is all the report I can get

Unfortunately we don’t know what generated the Intent that’s causing the issue - but it’s a good guess it’s something the plugin is doing. I can’t say what, but I know several other users are using admob plugins successfully. I can say this isn’t an error in our system but rather a problem with a unmaintained plugin.

Well that’s comforting, if others are using admob with the latest Android engine, then it is a solvable issue, so I can hope to find a solution. If there’s an example (a source code) of any kind of application that works with any abmob plugin it would be great for us to check it and see what is wrong with our code.

So if anyone here is willing to share a sample app using any admob plugin and working with the latest android version that would be great

Thanks

I had the same issue, it was down to how I installed it. The instructions for the plugin are outdated. It still reads today as using

cordova plugin add cordova-plugin-admobpro --save --variable PLAY_SERVICES_VERSION=20.4.0 --variable ADMOB_ANDROID_APP_ID=ca-app-pub-000000000000~00000000” command

It was the “PLAY_SERVICES_VERSION=20.4.0” that was at fault, it needs to be updated to the current version which, as of today, is 23.2.0, so the command should be

“cordova plugin add cordova-plugin-admobpro --save --variable PLAY_SERVICES_VERSION=23.2.0 --variable ADMOB_ANDROID_APP_ID=ca-app-pub-000000000000~00000000”

The latest version takes care of the FLAG_IMMUTABLE & FLAG_MUTABLE issue

So, if you have it installed, removing and reinstalling the plugin with the correct command should fix the error

cordova plugin remove cordova-plugin-admobpro

cordova plugin add cordova-plugin-admobpro --save --variable PLAY_SERVICES_VERSION=23.2.0 --variable ADMOB_ANDROID_APP_ID=ca-app-pub-000000000000~00000000