我已将 google AdMob 添加到项目中并发现此错误:
错误:找不到符号
导入 com.google.android.gms.ads.InterstitialAd;
^
符号:类 InterstitialAd
位置: com.google.android.gms.ads 包
最佳答案
我找到了答案:
将此代码添加到 build.gradle(app)
(在 android 标签中)
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:19.7.0"
}
}
如果您在一个库中使用了 admob,也将上面的代码添加到库 gradle
关于android - 错误 : cannot find symbol import com. google.android.gms.ads.InterstitialAd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69880113/