Error: cannot find symbol - gms ads

I recently started getting failures in my builds (even on code that used to work a few days ago or that produced a release version etc)

from the build log:

Task :app:compileDebugJavaWithJavac FAILED
/platforms/android/app/src/main/java/com/rjfun/cordova/admob/AdMobPlugin.java:23: error: cannot find symbol
import com.google.android.gms.ads.AdError;
symbol: class AdError
location: package com.google.android.gms.ads

/platforms/android/app/src/main/java/com/rjfun/cordova/admob/AdMobPlugin.java:34: error: package com.google.android.gms.ads.admanager does not exist
import com.google.android.gms.ads.admanager.AppEventListener;

(I get multiple instances of “error: cannot find symbol” and “error: package X does not exist”)

I consider this link to be relevant:
admob - Error: cannot find symbol import com.google.android.gms.ads.InterstitialAd - Stack Overflow

Thank you

Have you overridden the engine in your config.xml? Check if that is up to date(or use the default), as well as any plugins.

OK, solved!

I had used

<preference name="android-minSdkVersion" value="30" />	<!-- api level 29 = android 10.0 -->
<engine name="android" spec="10.0.1" />	<!-- needed to accept api level 30 -->

but it seems the problem was in the cordova-plugin-admobpro plugin. It got updated after about 5 years of inactivity… Changing the PLAY_SERVICES_VERSION value to 20.4.0 solved the issue for me.

<plugin name="cordova-plugin-admobpro" source="npm">
    <variable name="PLAY_SERVICES_VERSION" value="20.4.0" />
    <variable name="ADMOB_APP_ID" value="ca-app-pub-XXXXXXXXXX" />
</plugin>

thank you

Good work - and thank you for posting your solution!