0

我正在制作这个应用程序,在其中我使用 viewpager 制作选项卡我有一个片段,其片段的 Xml 文件如下所示。

RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="12dp"
    android:paddingRight="12dp">
      <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
          android:layout_marginBottom="80dp">
      <lumenghz.com.pullrefresh.PullToRefreshView
          android:id="@+id/refresh"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingBottom="30dp"
          >
      <ListView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingTop="20dp"
          android:id="@+id/list_item"
          android:dividerHeight="18dp"
          android:divider="@color/background_material_dark_1"
          android:layout_marginLeft="12dp"
          android:paddingBottom="30dp"
          />
      </lumenghz.com.pullrefresh.PullToRefreshView>
      </LinearLayout>
      <com.google.android.gms.ads.AdView
          android:id="@+id/adView2"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          ads:adSize="BANNER"
          ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxxxxxxxx"
          android:layout_alignParentBottom="true"
          />



</RelativeLayout>

我已经添加了从片段创建的活动中加载的广告小怪。

 public void onActivityCreated(@Nullable Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
            AdView mview = (AdView) code_chef_view.findViewById(R.id.adView2);
            AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .addTestDevice("A987C6AB63C6D5978CFCD37A5E0A1BD2").build();
            mview.loadAd(adRequest);
    }

但是我仍然没有运气,该应用程序根本没有显示任何添加

编辑

我已经添加了测试设备。但仍然在日志猫中,我得到以下输出。

05-25 22:53:25.563 3952-3952/com.example.illumy.codecompete I/Ads: Ad finished loading.
05-25 22:53:26.363 3952-4372/com.example.illumy.codecompete W/Ads: Error while pinging URL: https://pagead2.googleadservices.com/pagead/adview?ai=C5-JY9xInWZP4DcjMogPRgLSABKPT_P5Gu_zj1YcE5Kvp5bgBEAEgwuzcIGDlqueDxA6IAQGgAfvU0tcDqQLRte3gEgypPqgDAaoEyAFP0IrqdztxRahmvz2hxOH7_XDxCHUIUHuDbX-YI0V9FbcO3HVg3oGkgtTi1dQ41iSgY0pU1vpj-cNwreGF48ojYZrnpKrieaXXIPa7zdRJKMkiOvwgLmGfEub4zwChIoo8Ugus7thhcn5P9S-dSJN9FfcjgVQTw71RI-vchY_2jkYjB1xQjC8wNvE3izf0kLo8lvCSmwapJ_cEju4WzuKsRlK8LeEi156CmaHnM_SkMf6kjMOAkXje5LPd7GHP2a8SinlW7DIdnsAEt5ucv3yIBfW37cMCkAYBoAY5wAYLgAftqq0omAcBqAemvhvYBwGgCLTBPbAIAtIIBQiAARABsQnj9m_HuA3s-oIULRorbW9iaWxlYXBwOjoyLWNvbS5leGFtcGxlLmlsbHVteS5jb2RlY29tcGV0ZQ&sigh=QUko0PHK8eU&cid=CAASUeRo2clccqH7vOhLHEjtGjORhRNT7ouUYpJdPL0JXhtOrYzWxSDbugc8j2f6tOKTWbh5i-glOzCQgN_5yOidRaOw-qwaRSOhjbr37tIOCTlLNw&gvr=1. Unable to resolve host "pagead2.googleadservices.com": No address associated with hostname
05-25 22:53:36.433 3952-4369/com.example.illumy.codecompete I/System.out: KnoxVpnUidStorageknoxVpnSupported API value returned is false
4

0 回答 0