【问题标题】:Admob not showing banner ads on android pieAdmob 未在 android pie 上显示横幅广告
【发布时间】:2019-01-24 16:00:42
【问题描述】:

插页式广告在所有设备上都有效,但在三星 S8 等设备上的 android pie 中未显示横幅,横幅在其他 api 较低的设备上工作正常,两年前激活的 admob 工作正常意外。

我所有的应用程序都有同样的问题,横幅完美地在较低的“android Pie”上工作

我正在使用最新的 api

 implementation 'com.google.firebase:firebase-ads:17.1.2'

还在清单中添加了元数据

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxx~xxxxxxxxxxxx"/>
    <activity

这是我的密码

 MobileAds.initialize(getApplicationContext(), "ca-app-pub-XXXXXXXXXXXX~XXXXXXXXXX");
    AdView mAdView =  findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

布局代码

 <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="false"
            android:layout_alignParentStart="false"
            app:adSize="SMART_BANNER"
            app:adUnitId="@string/banner_ad_unit_id">

布局中也没有边距或内边距,使用上面相同的代码,在三星 s4 Huaweie 上运行 Adview、横幅等

***更新

我有另一个很久以前没有更新过的应用

  classpath 'com.google.gms:google-services:3.1.1'

和api

    compile 'com.google.firebase:firebase-ads:11.8.0'

    compileSdkVersion 27

Admob 横幅在三星 s8 上运行良好,有什么建议吗?我认为这是常见问题...

【问题讨论】:

  • 遇到同样的问题,有消息了吗?
  • 没有消息同样的问题

标签: android firebase admob


【解决方案1】:

@梦想家

在 android/app/build.gradle 中添加以下行后,我能够在 Android 9 手机中获取 admob 横幅,依赖项:

    implementation 'com.google.android.gms:play-services-ads:17.2.0'

请。检查这是否也可以解决您的问题。

更新:我忘了提到的另一个地方,即 android/app/src/main/AndroidManifest.xml:

    <application
        tools:replace="android:label"
        android:name="io.flutter.app.FlutterApplication"
        android:label="NameOfYourApp"
        android:usesCleartextTraffic="true"
        android:icon="@mipmap/ic_launcher">
        <uses-library android:name=org.apache.http.legacy android:required=false/>

即添加 2 行:

(1) 内部&lt;application&gt;

android:usesCleartextTraffic="true"

(2) 在&lt;application&gt; 之后,&lt;/application&gt; 之前

 <uses-library android:name=org.apache.http.legacy android:required=false/>

【讨论】:

  • @dreamer,请。检查更新的答案,这是因为一些广告仍在使用http,但Android 9默认只能使用https。
  • 我的编译和目标sdkversion是28,你的呢?
  • 我也有 sdk 版本 28,广告没有显示我试过普通横幅和智能横幅也同样的问题......
  • @Dreamer 你现在可以在 android 9 中展示广告吗?我和你有同样的问题。我的广告可以在旧的 android 中展示(我在 9 以下的 android 中测试)但不能在 android 9 中展示
  • 三星设备 android 9 没有显示广告的同样问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-04
相关资源
最近更新 更多