AdMob广告不更新到后装入“:播放服务的广告:com.google.android.gms 17.1.2”

问题描述 投票:0回答:1

我最近更新了“com.google.android.gms:播放服务的广告” dependendcies到17.1.2,我的AdMob广告将不再加载。我使用的版本11很长一段时间,从未发生过任何问题,但在更新后,他们将不再显示。

我看了看文件建立后,我意识到,你在启动活动,并在清单初始化APP-ID,所以我调整我的代码,但广告仍然没有显示,所以我尝试Admobs测试广告ID和它们的加载罚款。

所以,问题不能在AdMob广告权的落实?

在这里,我的build.gradle

     buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.25.4'
}
}
    apply plugin: 'com.android.application'
 apply plugin: 'io.fabric'

   repositories {
maven { url 'https://maven.fabric.io/public' }
 }


  android {
signingConfigs {
    config {
        keyAlias 'XX'
        keyPassword 'XX'
        storeFile file('XX')
        storePassword 'XX'
    }
    lintOptions {
        checkReleaseBuilds false
    }
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "XX"
    minSdkVersion 17
    targetSdkVersion 28
    versionCode XX
    versionName "XX"


    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable false
        signingConfig signingConfigs.config
    }
}

dexOptions {

    preDexLibraries = false
    javaMaxHeapSize "4g" // 2g should be also OK
}

 }


dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
// https://mvnrepository.com/artifact/com.android.support/customtabs
implementation group: 'com.android.support', name: 'customtabs', version: '28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.android.billingclient:billing:1.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.google.firebase:firebase-database:16.0.6'

  }

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

这里舱单的片段

   <?xml version="1.0" encoding="utf-8"?>

<!-- Include required permissions for Google Mobile Ads to run. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission. WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/appicon1"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.NoActionBar"
    >

    <!-- 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=".Splashscreen"

        android:label="@string/app_name"
        android:screenOrientation="portrait">

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

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

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </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"
         />

    <uses-library android:name="org.apache.http.legacy" android:required="false" />
    <meta-data
        android:name="io.fabric.ApiKey"
        android:value="XXX" />
    <!-- Sa+mple AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="@string/google_app_id"
        />
</application>

我的strings.xml

<string name="ad_unit_id" translatable="false">ca-app-pub-XXX/XX</string>
<string name="google_app_id" translatable="false">ca-app-pub-XXX~XX</string>
<string name="banner_ad_unit_id" translatable="false">ca-app-pub-XXX/XX</string>
<string name="reward_id" translatable="false">ca-app-pub-XXX/XX</string>

MAinactivity.class的片段

  public AdView mAdView;
     @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

  MobileAds.initialize(this, getString(R.string.google_app_id));

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

所以在看代码,我实在看不出有原因的广告将不会加载。还有什么你有关于AdMob广告的依赖关系升级时要考虑的?

java android admob ads google-play-services
1个回答
0
投票

我有类似的问题 - 测试广告的工作,但我自己不知道。我读的地方,他们就不会加载每次你打开你的应用程序,它需要几个小时才会显示出来,你将它们添加到您的应用程序后。只要去谷歌的AdMob控制台上,看到的展示数量 - 如果不是零 - 他们发现了别人的手机上。

你有没有更新谷歌的程序版本玩?如果你还没有,做到这一点。这样,你可以测试谷歌的AdMob控制台的解决方案,或者让我知道应用程序的名字,这样我就可以查,如果我看到自己的广告。

© www.soinside.com 2019 - 2024. All rights reserved.