【发布时间】: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