Моя реклама AdMob не загружается, будь то личный рекламный блок или тестовый. Объявление не удалось загрузить 0 - PullRequest
0 голосов
/ 09 июля 2020

Я пытался внедрить устаревший API объявления AdMob с вознаграждением в Android Studio. Хотя однажды это сработало, больше никогда не работало. Всегда в журналах сообщает, что мое объявление не удалось. Я пробовал устаревший API для рекламы с вознаграждением, новый API для рекламы с вознаграждением, но в конце всегда получаю тот же результат. Я использую идентификатор тестового приложения и идентификатор устройства, поэтому не может быть, что я недостаточно долго ждал подтверждения моей учетной записи AdMob. Пожалуйста, помогите.

2020-07-09 15:26:45.483 5299-5299/? I/igninwallpaper: Not late-enabling -Xcheck:jni (already on)
2020-07-09 15:26:45.512 5299-5299/? I/igninwallpaper: Unquickening 12 vdex files!
2020-07-09 15:26:45.516 5299-5299/? W/igninwallpaper: Unexpected CPU variant for X86 using defaults: x86
2020-07-09 15:26:45.799 5299-5299/com.example.reigninwallpapers D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-07-09 15:26:45.802 5299-5299/com.example.reigninwallpapers D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-07-09 15:26:45.910 5299-5324/com.example.reigninwallpapers D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-07-09 15:26:45.926 5299-5324/com.example.reigninwallpapers D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-07-09 15:26:45.936 5299-5324/com.example.reigninwallpapers D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-07-09 15:26:46.054 5299-5326/com.example.reigninwallpapers W/DynamiteModule: Local module descriptor class for com.google.android.gms.measurement.dynamite not found.
2020-07-09 15:26:46.055 5299-5321/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.059 5299-5321/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.063 5299-5321/com.example.reigninwallpapers I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21400
2020-07-09 15:26:46.064 5299-5321/com.example.reigninwallpapers I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21400
2020-07-09 15:26:46.066 5299-5321/com.example.reigninwallpapers V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2020-07-09 15:26:46.070 5299-5326/com.example.reigninwallpapers I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:0 and remote module com.google.android.gms.measurement.dynamite:13
2020-07-09 15:26:46.071 5299-5326/com.example.reigninwallpapers I/DynamiteModule: Selected remote version of com.google.android.gms.measurement.dynamite, version >= 13
2020-07-09 15:26:46.072 5299-5326/com.example.reigninwallpapers V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2020-07-09 15:26:46.110 5299-5326/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.116 5299-5326/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.122 5299-5299/com.example.reigninwallpapers W/igninwallpaper: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-07-09 15:26:46.123 5299-5299/com.example.reigninwallpapers W/igninwallpaper: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-07-09 15:26:46.127 5299-5321/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.141 5299-5326/com.example.reigninwallpapers W/DynamiteModule: Local module descriptor class for com.google.android.gms.measurement.dynamite not found.
2020-07-09 15:26:46.173 5299-5321/com.example.reigninwallpapers W/igninwallpaper: Unsupported class loader
2020-07-09 15:26:46.275 5299-5299/com.example.reigninwallpapers I/WebViewFactory: Loading com.google.android.webview version 83.0.4103.44 (code 410404481)
2020-07-09 15:26:46.307 5299-5299/com.example.reigninwallpapers I/igninwallpaper: The ClassLoaderContext is a special shared library.
2020-07-09 15:26:46.343 5299-5299/com.example.reigninwallpapers I/igninwallpaper: The ClassLoaderContext is a special shared library.
2020-07-09 15:26:46.354 5299-5329/com.example.reigninwallpapers I/FA-Ads: App measurement initialized, version: 26016
2020-07-09 15:26:46.354 5299-5329/com.example.reigninwallpapers I/FA-Ads: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2020-07-09 15:26:46.377 5299-5299/com.example.reigninwallpapers I/cr_LibraryLoader: Loaded native library version number "83.0.4103.44"
2020-07-09 15:26:46.377 5299-5299/com.example.reigninwallpapers I/cr_CachingUmaRecorder: Flushed 3 samples from 3 histograms.
2020-07-09 15:26:46.382 5299-5299/com.example.reigninwallpapers I/TetheringManager: registerTetheringEventCallback:com.example.reigninwallpapers
2020-07-09 15:26:46.625 5299-5366/com.example.reigninwallpapers W/igninwallpaper: Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (greylist, reflection, allowed)
2020-07-09 15:26:46.637 5299-5366/com.example.reigninwallpapers W/cr_media: Requires BLUETOOTH permission
2020-07-09 15:26:46.662 5299-5382/com.example.reigninwallpapers D/HostConnection: HostConnection::get() New Host Connection established 0xebb9e550, tid 5382
2020-07-09 15:26:46.677 5299-5382/com.example.reigninwallpapers D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
2020-07-09 15:26:46.698 5299-5382/com.example.reigninwallpapers E/chromium: [ERROR:gl_surface_egl.cc(549)] eglChooseConfig failed with error EGL_SUCCESS
2020-07-09 15:26:46.739 5299-5382/com.example.reigninwallpapers D/EGL_emulation: eglCreateContext: 0xeb9a9050: maj 2 min 0 rcv 2
2020-07-09 15:26:46.742 5299-5382/com.example.reigninwallpapers D/EGL_emulation: eglMakeCurrent: 0xeb9a9050: ver 2 0 (tinfo 0xbc2c3530) (first time)
2020-07-09 15:26:46.763 5299-5299/com.example.reigninwallpapers I/Ads: This request is sent from a test device.
2020-07-09 15:26:46.769 5299-5382/com.example.reigninwallpapers E/chromium: [ERROR:gl_surface_egl.cc(549)] eglChooseConfig failed with error EGL_SUCCESS
2020-07-09 15:26:46.806 5299-5382/com.example.reigninwallpapers I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2020-07-09 15:26:46.810 5299-5382/com.example.reigninwallpapers W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
2020-07-09 15:26:46.827 5299-5382/com.example.reigninwallpapers D/EGL_emulation: eglCreateContext: 0xeb9aa6a0: maj 2 min 0 rcv 2
2020-07-09 15:26:46.941 5299-5330/com.example.reigninwallpapers D/zzex: File /data/user/0/com.example.reigninwallpapers/cache/1584479576572.dex not found. No need for deletion
2020-07-09 15:26:46.959 5299-5299/com.example.reigninwallpapers I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21400
2020-07-09 15:26:46.959 5299-5299/com.example.reigninwallpapers I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21400
2020-07-09 15:26:46.959 5299-5299/com.example.reigninwallpapers V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2020-07-09 15:26:47.010 5299-5426/com.example.reigninwallpapers W/Ads: Invoke Firebase method getInstance error.
2020-07-09 15:26:47.010 5299-5426/com.example.reigninwallpapers W/Ads: 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
2020-07-09 15:26:47.173 5299-5299/com.example.reigninwallpapers I/Choreographer: Skipped 31 frames!  The application may be doing too much work on its main thread.
2020-07-09 15:26:47.196 5299-5322/com.example.reigninwallpapers D/HostConnection: HostConnection::get() New Host Connection established 0xebba50f0, tid 5322
2020-07-09 15:26:47.204 5299-5322/com.example.reigninwallpapers D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
2020-07-09 15:26:47.204 5299-5322/com.example.reigninwallpapers W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2020-07-09 15:26:47.220 5299-5322/com.example.reigninwallpapers D/EGL_emulation: eglCreateContext: 0xeb9ab740: maj 2 min 0 rcv 2
2020-07-09 15:26:47.226 5299-5322/com.example.reigninwallpapers D/EGL_emulation: eglMakeCurrent: 0xeb9ab740: ver 2 0 (tinfo 0xbc2d07d0) (first time)
2020-07-09 15:26:47.256 5299-5322/com.example.reigninwallpapers I/Gralloc4: mapper 4.x is not supported
2020-07-09 15:26:47.258 5299-5322/com.example.reigninwallpapers D/HostConnection: createUnique: call
2020-07-09 15:26:47.258 5299-5322/com.example.reigninwallpapers D/HostConnection: HostConnection::get() New Host Connection established 0xebba8330, tid 5322
2020-07-09 15:26:47.259 5299-5322/com.example.reigninwallpapers D/eglCodecCommon: allocate: Ask for block of size 0x100
2020-07-09 15:26:47.259 5299-5322/com.example.reigninwallpapers D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3f66da000 size 0x2000
2020-07-09 15:26:47.265 5299-5322/com.example.reigninwallpapers D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 
<br>
2020-07-09 15:26:47.379 5299-5299/com.example.reigninwallpapers I/Ads: <b>Ad failed to load : 0</b>
<br>
2020-07-09 15:26:47.526 5299-5313/com.example.reigninwallpapers I/igninwallpaper: WaitForGcToComplete blocked Background on None for 9.520ms
2020-07-09 15:26:52.579 5299-5329/com.example.reigninwallpapers W/ConnectionTracker: Exception thrown while unbinding
    java.lang.IllegalArgumentException: Service not registered: lm@e211662
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1729)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1874)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:792)
        at ce.b(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):1)
        at ce.a(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):5)
        at ln.A(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):10)
        at ky.a(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):3)
        at dy.run(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):2)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at iw.run(:com.google.android.gms.dynamite_measurementdynamite@201817052@20.18.17 (040700-0):15)

1 Ответ

0 голосов
/ 09 июля 2020
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.reward.RewardedVideoAd;

public class MainActivity extends AppCompatActivity implements RewardedVideoAdListener {
    private RewardedVideoAd mRewardedVideoAd;
private String UNIT_ID ="ca-app-pub-3940256099942544/5224354917";//change to your unit ID
private String APP_ID = "ca-app-pub-3940256099942544~3347511713";// change to your app id.



   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        MobileAds.initialize(this, UNIT_ID);

        // Use an activity context to get the rewarded video instance.
        mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
        mRewardedVideoAd.setRewardedVideoAdListener(this);


       loadRewardedVideoAd();
    }
   

 private void loadRewardedVideoAd() {
mRewardedVideoAd.loadAd(UNIT_ID,
        new AdRequest.Builder().build());
}

}

Настройка уведомлений о событиях.

@Override
public void onRewarded(RewardItem reward) {
    Toast.makeText(this, "onRewarded! currency: " + reward.getType() + "  amount: " +
            reward.getAmount(), Toast.LENGTH_SHORT).show();
    // Reward the user.
}

@Override
public void onRewardedVideoAdLeftApplication() {
    Toast.makeText(this, "onRewardedVideoAdLeftApplication",
            Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdClosed() {
    Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
    Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdLoaded() {
    Toast.makeText(this, "onRewardedVideoAdLoaded", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdOpened() {
    Toast.makeText(this, "onRewardedVideoAdOpened", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoStarted() {
    Toast.makeText(this, "onRewardedVideoStarted", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoCompleted() {
    Toast.makeText(this, "onRewardedVideoCompleted", Toast.LENGTH_SHORT).show();
}

Отображение видеообъявления с вознаграждением, чтобы убедиться, что видеообъявление с вознаграждением завершило загрузку, прежде чем пытаться его отобразить. Метод isLoaded () указывает, был ли успешно выполнен запрос видеообъявления с вознаграждением.

if (mRewardedVideoAd.isLoaded()) {
    mRewardedVideoAd.show();
}

RewardedVideoAdListener для перезагрузки объявления. Этот метод удобен для загрузки нового видеообъявления с вознаграждением после отображения предыдущего.

@Override
public void onRewardedVideoAdClosed() {
    // Load the next rewarded video ad.
    loadRewardedVideoAd();
}

Лучше использовать прямые события жизненного цикла.

@Override
public void onResume() {
    mRewardedVideoAd.resume(this);
    super.onResume();
}

@Override
public void onPause() {
    mRewardedVideoAd.pause(this);
    super.onPause();
}

@Override
public void onDestroy() {
    mRewardedVideoAd.destroy(this);
    super.onDestroy();
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...