【问题标题】:W/Ads: #004 The webview is destroyed. Ignoring action带广告:#004 网络视图被破坏。忽略动作
【发布时间】:2022-04-19 07:10:51
【问题描述】:

日志:

2021-12-28 13:15:51.438 17135-17135/app.mark.movierecommendor I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100
    2021-12-28 13:15:51.438 17135-17135/app.mark.movierecommendor I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100
    2021-12-28 13:15:51.509 17135-17135/app.mark.movierecommendor W/Ads: #004 The webview is destroyed. Ignoring action.
    2021-12-28 13:15:51.510 17135-17135/app.mark.movierecommendor I/chatty: uid=10280(app.mark.movierecommendor) identical 1 line
    2021-12-28 13:15:51.510 17135-17135/app.mark.movierecommendor W/Ads: #004 The webview is destroyed. Ignoring action.

XML:

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adBannerMainActivity"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    ads:adUnitId="@string/add_id_with_dash"
    />

代码:

// Launch and Initialize Ad Banner
MobileAds.initialize(this@ActionMoviePageActivity)
val adRequest = AdRequest.Builder().build()
adBannerOther.loadAd(adRequest)

这是第二个活动,第一个工作正常,但是当我按下按钮打开第二个活动时,它给了我这个错误W/Ads: #004 The webview is destroyed. Ignoring action.

【问题讨论】:

  • 这不是错误,只是警告。此警告主要在广告刷新期间弹出,或者当 AdView 从视图中分离/删除或主机 Activity 被销毁时弹出。它不会引起任何问题。

标签: android admob


【解决方案1】:

我遇到了同样的问题。我通过将根元素从约束布局更改为相对布局来修复它

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多