android - 在未集成 Google 移动广告的情况下在 Android 上使用 Google Advertising Id

标签 android google-play-services ads google-advertising-id

在 Android 上获取 Google 广告 ID 需要导入 play-services-ads依赖。

从 17.0.0 开始,此依赖项强制应用程序 list 包含 <meta-data>带键的标签 com.google.android.gms.ads.APPLICATION_ID .缺少标记会导致应用程序崩溃。

但我想为与 Google 移动广告无关的广告目的检索 Google 广告 ID,而且我没有应用程序 ID。

有谁知道现在如何进行?

最佳答案

您可以使用 play-services-ads-identifier 而不是 play-services-ads

implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'

这将仅导入广告 ID 类,而不导入 Google 移动广告/AdMob。

关于android - 在未集成 Google 移动广告的情况下在 Android 上使用 Google Advertising Id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53412926/

相关文章:

Android Studio - 外部库文件夹不刷新

android - 在查看时 Gradle 警告 : Could not find google-services. json

php - 广告系统提示

windows-8 - WinRT 广告替代 Microsoft Pubcenter

android - Google 服务广告在加载广告时的行为与 AdMob SDK 不同吗?

java - 仅在 androidTest : Invoke-customs are only supported starting with Android O

android - 发布 XML 请求和 XML 响应 Volley 库

java - Android:onConnected、onConnectionSupspended 或 onConnectionFailed 都没有被调用

android - 使用 Fragments 或 Activity 的底部导航

android - 使用 Intent 请求获取用户编号不起作用?