【问题标题】:My Android app shows Admob interstitial Test ads but not real ads我的 Android 应用显示 Admob 插页式测试广告,但不是真实广告
【发布时间】:2020-11-12 00:21:05
【问题描述】:

我的 Android 应用显示 Admob 插页式测试广告,但不显示真实广告。在发布这个问题之前,我尝试了很多解决方案。但我找不到任何工作的答案。 我也尝试使用新的广告 ID。 (等了 2 周还是一无所获……) 并且测试广告效果很好。

我猜问题出在 build.gradle 应用程序中

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.xxxxx.yyyyy"
        minSdkVersion 18
        targetSdkVersion 27
        buildToolsVersion "27.0.0"
        versionCode 1
        versionName "2.0"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:support-v4:27.0.0'
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.android.gms:play-services-ads:11.8.0'

}

我尝试迁移到 AndroidX 。仍然无法正常工作并且有很多错误...

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.xxxxx.yyyyy"
        minSdkVersion 18
        targetSdkVersion 28
        buildToolsVersion "28.0.3"
        versionCode 1
        versionName "2.0"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.annotation:annotation:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'com.google.android.gms:play-services-ads:19.5.0'

}

【问题讨论】:

  • 在调试版本中显示测试广告似乎是合理的。您是否检查过AdmobId 并尝试构建发布版本?
  • 请在您的问题中捕获日志并更新

标签: android admob build.gradle google-play-services androidx


【解决方案1】:

将您的设备设置为测试设备。检查this 以设置测试设备。 如果您使用的是模拟器,它已经设置为测试设备。 使用测试 ID 来测试广告。 仅当您想发布应用程序时才使用您的原始应用程序 ID 和广告 ID。 确保您的 Ad mod 帐户没有任何限制(例如正在评估帐户、广告投放受限)。

【讨论】:

    猜你喜欢
    • 2015-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-16
    • 1970-01-01
    • 2018-02-01
    • 1970-01-01
    相关资源
    最近更新 更多