Android 工作室横幅广告未展示

Android studio banner ads not showing

我在哪做mistakes.Ads不是appearing.Can你帮忙你能帮忙你能帮忙你能帮忙吗

清单文件 '

package="com.cansifakitabi.ruyalarinanlami" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/favicon"
    android:label="Rüyaların Anlamı"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme" >

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity
        android:name="com.cansifakitabi.ruyalarinanlami.MainActivity">



        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.cansifakitabi.ruyalarinanlami.Webactivity">

    </activity>

    <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />
</application>

'

java 文件

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

string.xml 文件

ca-app-pub-71396921xxxxxxx/xxxxxxxx

layout.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout android:id="@+id/linearLayoutWebView"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical">
        <WebView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fitsSystemWindows="true"
            android:id="@+id/web_engine"
            />
    </LinearLayout>

<LinearLayout android:layout_width="fill_parent"
    android:id="@+id/ad_layout" android:layout_height="wrap_content"
    android:gravity="bottom" android:layout_alignParentBottom="true"
    android:layout_alignBottom="@+id/linearLayoutWebView">
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id"/>
</LinearLayout>

enter image description here

Google 不允许,开发人员在应用程序处于开发阶段时使用真实横幅。

有两种实现方法

  1. 使用横幅 ID ca-app-pub-3940256099942544/6300978111

  2. 将测试设备添加到您的 AdRequest

    AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice("0FA20932AFE1095798444FD9AAB7D425")
        .build();