Android Studio:Google Admob Interstitial 测试广告仅部分起作用

问题描述

我在虚拟设备上使用来自 Google Admob 的测试插页式广告时遇到问题。它只是部分工作。它在我的虚拟设备 Nexus S (API 21)、Nexus 9 (API 29) 和 Pixel 2 (API 30) 上运行良好,但不适用于 Nexus 6 (API 22) 和 Nexus 9 (API 22)。 我还取消了并实现了 2 个不工作的虚拟设备,但它们仍然不工作,我收到以下消息: “W/Ads:调用 Firebase 方法 getInstance 错误。 Google 移动广告 SDK 不会与 Firebase 集成。 Admob/Firebase 集成需要最新的 Firebase SDK jar,但 Firebase SDK 缺失或过时"

"W/Ads: Invoke Firebase method getInstance error.
    The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar,but Firebase SDK is either missing or out of date"

这可能是什么原因?我的依赖项中是否还需要 Firebase 实现?如果是,为什么只针对少数虚拟设备/API?

在下面查看我的 Gradle 编码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsversion "30.0.2"

    defaultConfig {
        applicationId "com.example.riskbattlehelper"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation filetree(dir: "libs",include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation "com.airbnb.android:lottie:3.5.0"
    implementation 'com.google.android.gms:play-services-ads:19.6.0'
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)