示例AdMob ID不显示广告

时间:2019-02-08 23:57:36

标签: android admob

我创建了一个最小的示例。

活动:

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
        final InterstitialAd ad = new InterstitialAd(this);
        ad.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
        ad.loadAd(new AdRequest.Builder().build());

        ad.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                ad.show();
            }
        });
    }
}

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cyberdynesoftware.interstitial">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>
    </application>

</manifest>

和gradle构建文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "cyberdynesoftware.interstitial"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

已在Android Studio中使用虚拟设备进行了测试。广告不会显示。

并且要强调一下:显示的ID是https://developers.google.com/admob/android/quick-start中的示例ID。新创建的AD ID的等待时间不适用于此处,因为到目前为止,我已经找到了解决该问题的所有答案。

这是运行应用程序的输出:

02/08 17:41:02: Launching app
$ adb install-multiple -r -t /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/dep/dependencies.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_1.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_2.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_0.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_4.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_5.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_3.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_7.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_6.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_8.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/split-apk/debug/slices/slice_9.apk /Users/ingmar/projects/Interstitial/app/build/intermediates/instant-run-apk/debug/app-debug.apk 
Split APKs installed in 1 s 942 ms
$ adb shell am start -n "cyberdynesoftware.interstitial/cyberdynesoftware.interstitial.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 4708 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/System: ClassLoader referenced unknown path: /data/app/cyberdynesoftware.interstitial-2/lib/x86
I/InstantRun: starting instant run server: is main process
W/art: Verification of int android.support.v4.app.FragmentActivity.allocateRequestIndex(android.support.v4.app.Fragment) took 106.764ms
W/art: Verification of com.google.android.gms.dynamite.DynamiteModule com.google.android.gms.dynamite.DynamiteModule.load(android.content.Context, com.google.android.gms.dynamite.DynamiteModule$VersionPolicy, java.lang.String) took 539.431ms
W/art: Verification of java.lang.Object cyberdynesoftware.interstitial.MainActivity.access$super(cyberdynesoftware.interstitial.MainActivity, java.lang.String, java.lang.Object[]) took 369.754ms
W/DynamiteModule: Local module descriptor class for com.google.android.gms.measurement.dynamite not found.
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:0 and remote module com.google.android.gms.measurement.dynamite:0
W/Ads: Data collection startup failed. No data will be collected.
    com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
        at com.google.android.gms.dynamite.DynamiteModule.load(Unknown Source)
        at com.google.android.gms.internal.measurement.zzea.zzg(Unknown Source)
        at com.google.android.gms.internal.measurement.zzeb.zzgd(Unknown Source)
        at com.google.android.gms.internal.measurement.zzea$zzb.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
    Failed to connect to measurement client.
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:320 and remote module com.google.android.gms.ads.dynamite:0
    Selected local version of com.google.android.gms.ads.dynamite
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
W/Ads: #007 Could not call remote method. @28
    com.google.android.gms.internal.ads.zzbbg: com.google.android.gms.dynamite.DynamiteModule$LoadingException: Failed to instantiate module class: com.google.android.gms.ads.measurement.DynamiteMeasurementManager
        at com.google.android.gms.internal.ads.zzbbe.zza(Unknown Source)
        at com.google.android.gms.internal.ads.zzakm.zza(Unknown Source)
        at com.google.android.gms.internal.ads.zzakn.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: com.google.android.gms.dynamite.DynamiteModule$LoadingException: Failed to instantiate module class: com.google.android.gms.ads.measurement.DynamiteMeasurementManager
        at com.google.android.gms.dynamite.DynamiteModule.instantiate(Unknown Source)
        at com.google.android.gms.internal.ads.zzbbe.zza(Unknown Source)
        at com.google.android.gms.internal.ads.zzakm.zza(Unknown Source) 
        at com.google.android.gms.internal.ads.zzakn.run(Unknown Source) 
        at java.lang.Thread.run(Thread.java:761) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.measurement.DynamiteMeasurementManager" on path: DexPathList[[zip file "/data/app/cyberdynesoftware.interstitial-2/base.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_dependencies_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_0_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_1_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_2_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_3_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_4_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_5_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_6_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_7_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_8_apk.apk", zip file "/data/app/cyberdynesoftware.interstitial-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/cyberdynesoftware.interstitial-2/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.google.android.gms.dynamite.DynamiteModule.instantiate(Unknown Source)
        at com.google.android.gms.internal.ads.zzbbe.zza(Unknown Source) 
        at com.google.android.gms.internal.ads.zzakm.zza(Unknown Source) 
        at com.google.android.gms.internal.ads.zzakn.run(Unknown Source) 
        at java.lang.Thread.run(Thread.java:761) 
        Suppressed: java.io.IOException: No original dex files found for dex location /data/app/cyberdynesoftware.interstitial-2/split_lib_slice_7_apk.apk
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:367)
        at dalvik.system.DexFile.<init>(DexFile.java:112)
        at dalvik.system.DexFile.<init>(DexFile.java:77)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
        at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
        at dalvik.system.DexPathList.<init>(DexPathList.java:126)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
        at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1866)
        at android.app.LoadedApk.getResources(LoadedApk.java:766)
        at android.app.ContextImpl.<init>(ContextImpl.java:2038)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5294)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xae76f090
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/System: ClassLoader referenced unknown path: /system/app/Chrome/lib/x86
D/ApplicationLoaders: ignored Vulkan layer search path /system/app/Chrome/lib/x86:/system/app/Chrome/Chrome.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xae76f0d0
I/WebViewFactory: Loading com.android.chrome version 55.0.2883.91 (code 288309112)
I/cr_LibraryLoader: Time to load native libraries: 6 ms (timestamps 7357-7363)
I/cr_LibraryLoader: Expected native library version number "55.0.2883.91", actual native library version number "55.0.2883.91"
I/cr_LibraryLoader: Expected native library version number "55.0.2883.91", actual native library version number "55.0.2883.91"
I/chromium: [INFO:library_loader_hooks.cc(163)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
D/: HostConnection::get() New Host Connection established 0x9ed17940, tid 4708
D/EGL_emulation: eglCreateContext: 0x9ed11540: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0x9ed11540: ver 3 0 (tinfo 0x9ed1bd10)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
    glUtilsParamSize: unknow param 0x00008824
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
I/Ads: Starting ad request.
    SDK version: afma-sdk-a-v14300000.14300000.0
I/Ads: This request is sent from a test device.
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/Ads: Google Play Service is out of date, the Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires updated Google Play Service.
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/: HostConnection::get() New Host Connection established 0xa36ffe00, tid 4760
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xae4069e0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xae4069e0: ver 3 0 (tinfo 0x852d0700)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
    glUtilsParamSize: unknow param 0x00008824
W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
D/zzdl: File /data/user/0/cyberdynesoftware.interstitial/cache/1529567361524.dex not found. No need for deletion
W/art: Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
    Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
    Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random
I/art: Background sticky concurrent mark sweep GC freed 15723(1928KB) AllocSpace objects, 12(804KB) LOS objects, 40% free, 5MB/8MB, paused 5.982ms total 29.281ms
D/EGL_emulation: eglMakeCurrent: 0xae4069e0: ver 3 0 (tinfo 0x852d0700)
W/GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 10298470
W/cr_media: Requires BLUETOOTH permission
I/cr_Ime: ImeThread is enabled.
E/chromium: [ERROR:interface_registry.cc(104)] Failed to locate a binder for interface: autofill::mojom::PasswordManagerDriver
E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
D/: HostConnection::get() New Host Connection established 0x82f8a9c0, tid 4789
D/EGL_emulation: eglCreateContext: 0x82f871e0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0x82f871e0: ver 3 0 (tinfo 0x84aedf50)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
    glUtilsParamSize: unknow param 0x00008824
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
D/EGL_emulation: eglCreateContext: 0x82f884a0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0x82f884a0: ver 3 0 (tinfo 0x84aedf50)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008a34
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008073
    glUtilsParamSize: unknow param 0x000088ff
E/Ads: Error waiting for future.
    java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException
        at com.google.android.gms.internal.ads.zzbcl.get(Unknown Source)
        at com.google.android.gms.internal.ads.zzbbq.zza(Unknown Source)
        at com.google.android.gms.internal.ads.zzatq.zza(Unknown Source)
        at com.google.android.gms.internal.ads.zzatq.zzb(Unknown Source)
        at com.google.android.gms.internal.ads.zzats.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: java.util.concurrent.TimeoutException
        at com.google.android.gms.internal.ads.zzbbu.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at java.lang.Thread.run(Thread.java:761) 
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 4708
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 4708

更新:我已经创建了一个新的Pixel 2虚拟设备,其Android 9,API级别为28。广告仍然没有显示。这是输出:

02/09 11:00:21: Launching app
$ adb push /Users/ingmar/projects/Interstitial/app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/cyberdynesoftware.interstitial
$ adb shell pm install -t -r "/data/local/tmp/cyberdynesoftware.interstitial"
Success
APK installed in 5 s 319 ms
$ adb shell am start -n "cyberdynesoftware.interstitial/cyberdynesoftware.interstitial.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Waiting for process to come online
Connected to process 4587 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/DynamiteModule: Local module descriptor class for com.google.android.gms.measurement.dynamite not found.
W/re.interstitia: Unsupported class loader
W/re.interstitia: Long monitor contention with owner Thread-2 (4617) at int com.google.android.gms.dynamite.DynamiteModule.zza(android.content.Context, java.lang.String, boolean)(:55) waiters=0 in int com.google.android.gms.dynamite.DynamiteModule.zza(android.content.Context, java.lang.String, boolean) for 396ms
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:310
    Selected remote version of com.google.android.gms.ads.dynamite, version >= 310
W/DynamiteModule: Dynamite loader version < 2, falling back to loadModule2
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:0 and remote module com.google.android.gms.measurement.dynamite:0
W/Ads: Data collection startup failed. No data will be collected.
    com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
        at com.google.android.gms.dynamite.DynamiteModule.load(Unknown Source:8)
        at com.google.android.gms.internal.measurement.zzea.zzg(Unknown Source:51)
        at com.google.android.gms.internal.measurement.zzeb.zzgd(Unknown Source:3)
        at com.google.android.gms.internal.measurement.zzea$zzb.run(Unknown Source:11)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
    Failed to connect to measurement client.
W/re.interstitia: Unsupported class loader
W/re.interstitia: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/re.interstitia: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
W/re.interstitia: Skipping duplicate class check due to unsupported classloader
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/Ads: Starting ad request.
    SDK version: afma-sdk-a-v14300000.14300000.0
I/Ads: This request is sent from a test device.
I/WebViewFactory: Loading com.android.chrome version 66.0.3359.158 (code 336015817)
I/re.interstitia: The ClassLoaderContext is a special shared library.
I/re.interstitia: The ClassLoaderContext is a special shared library.
D/zzdl: File /data/user/0/cyberdynesoftware.interstitial/cache/1529567361524.dex not found. No need for deletion
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
W/re.interstitia: Long monitor contention with owner pool-2-thread-12: (4646) at byte[] com.google.android.gms.internal.ads.zzcw.zza(byte[], java.lang.String)(:57) waiters=5 in byte[] com.google.android.gms.internal.ads.zzcw.zza(byte[], java.lang.String) for 110ms
D/OpenGLRenderer: Skia GL Pipeline
I/cr_LibraryLoader: Time to load native libraries: 2 ms (timestamps 1352-1354)
D/: HostConnection::get() New Host Connection established 0xd5844d40, tid 4660
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
    android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xec25ef40: maj 3 min 0 rcv 3
I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "66.0.3359.158", actual native library version number "66.0.3359.158"
D/EGL_emulation: eglMakeCurrent: 0xec25ef40: ver 3 0 (tinfo 0xe7870e00)
D/EGL_emulation: eglMakeCurrent: 0xec25ef40: ver 3 0 (tinfo 0xe7870e00)
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0

这次,Google Play服务还没有过时,但是广告仍然没有显示。

3 个答案:

答案 0 :(得分:0)

更新虚拟设备的Google Play服务可能会对您有所帮助。

更新

问题似乎不同。我认为创建一个Google AdMob帐户并使用您自己的AdMob应用ID一定可以解决该问题。您将使用自己的应用ID,但仍可以使用测试单元ID作为单元ID

更新2

问题可能出在您的布局xml文件或项目级build.gradle。您是否在项目级别的build.gradle中添加了以下代码?

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

答案 1 :(得分:0)

您是否在物理Android设备上尝试过相同的操作?

  

Google Play服务已过期。需要12451000但找到10298470

我对此表示怀疑,因此请更改或更新您的游戏服务版本。您是否将Play服务版本手动放置在integers.xml文件或清单文件中?

谢谢,请让我知道。

答案 2 :(得分:-1)

如下更新您的活动

     ad.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
             ad.loadAd(new AdRequest.Builder().build());
        }

我希望这会有所帮助