I had added google AdMob to the project and found this error : error: cannot find symbol import com.google.android.gms.ads.InterstitialAd; ^ symbol: class InterstitialAd location: package com.google.android.gms.ads
If you get this error after updating your com.google.android.gms:play-services-ads dependency to a more recent version, know that importing com.google.android.gms.ads.InterstitialAd has been deprecated since version 19.7.0 and has since been totally removed.
The new import should be:
import com.google.android.gms.ads.interstitial.InterstitialAd;
Either revert com.google.android.gms:play-services-ads to a version pre-19.7.0 or update your code by following the documentation here: https://developers.google.com/admob/android/interstitial.
I found the answer : add this codes to build.gradle(app) (in the android tag )
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-basement:17.0.0"
force "com.google.android.gms:play-services-base:17.1.0"
force "com.google.android.gms:play-services-stats:17.0.0"
force "com.google.android.gms:play-services-gcm:17.0.0"
force "com.google.android.gms:play-services-ads:22.6.0"
}
}
and if you had use of admob in the one library add codes above to library gradle too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With