首页 > 解决方案 > 添加 admob 广告库后混合版本可能会导致运行时崩溃

问题描述

我知道有很多这样的问题,但没有找到任何具有 Admob 广告依赖的问题,我只想在我的应用中使用 Admob 广告,我从官方网站添加了广告依赖implementation 'com.google.android.gms:play-services-ads:15.0.0'

但向我展示了这个警告:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.0.1, 15.0.0. Examples include com.google.android.gms:play-services-ads-identifier:15.0.1   and com.google.android.gms:play-services-ads:15.0.0 less... (Ctrl+F1) 
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

我只想在没有 Firebase 的情况下使用广告依赖。

标签: androidfirebaseandroid-gradle-pluginadmobbuild.gradle

解决方案


检查您的 app-gradle 文件,您的依赖项有冲突。更新以下内容

com.google.android.gms:play-services-ads:15.0.1

推荐阅读