繁体   English   中英

Admob在Android Studio中显示测试广告,但在Google Play中完全没有广告

[英]Admob shows Test ads in android studio but no ads at all in google play

表现

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hightimes.fourtwenty">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="4:20"
    android:theme="@style/AppTheme" >
    <!--This meta-data tag is required to use Google Play Services.-->
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    <activity android:name=".MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <!--Include the AdActivity configChanges and theme. -->
    <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的

MobileAds.initialize(this,"@string/banner_app_id");

mAdView = (AdView) findViewById(R.id.myAdView);

AdRequest adRequest = new AdRequest.Builder()

.build();


mAdView.loadAd(adRequest);

布局文件

    <com.google.android.gms.ads.AdView
    android:id="@+id/myAdView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id"
    />

Gradle脚本文件

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.android.support:design:23.4.0'
}


apply plugin: 'com.google.gms.google-services'

使用android studio可以很好地加载测试广告,而在不同的测试设备和位置上完全不会展示实时Google Play广告。 我在admob应用程序管理页面内链接了该广告,它显示为1个活动广告。 我正在使用admob生成的appID和adunitID,并且还包含google-services.json文件。我唯一能想到的是,广告需要花费几天的时间来填充,或者我的应用程序显示与毒品相关的材料,它的评分为+18,但我从未收到admob的通知,也没有看到任何帐户被暂停的信息。 感谢您对高级的任何帮助!

MobileAds.initialize(此, “@串/ banner_app_id”);

您正在传递字符串“ @ string / banner_app_id”作为应用程序ID。

要查找与您的应用程序对应的应用程序ID,请在AdMob帐户页面上的设置下拉菜单(位于右上角)下单击“应用程序管理”选项。 应用程序ID的格式为ca-app-pub-XXXXXXXXXXXXXXXX〜NNNNNNNNNN。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM