简体   繁体   English

admob 测试广告 id 正常工作,但真实 id 广告在 android 工作室中不起作用

[英]admob test ads id properly working but real id ads is not working in android studio

i did very possible way but it is not working i used the relative layout and linear layout bothin xml file bou not working, we use id with in the xml file to我做了非常可能的方法,但它不起作用我在 xml 文件中使用了相对布局和线性布局,但我们在 xml 文件中使用了 id

XML XML

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

java java

 AdView mAdView = (AdView) findViewById(com.zapps.medical.dictionary.offlinefree.R.id.adView);
            AdRequest adRequest = new AdRequest.Builder()
                  //  .addTestDevice("A3DDA4788920C47C5C6D402059AE4245")
                    .build();
            mAdView.loadAd(adRequest);

we use the banner id in java code to我们使用 java 代码中的横幅 id

string ca-app-pub-6534443061196093/5988881403字符串 ca-app-pub-6534443061196093/5988881403

in manifest file we did it @integer/version and app id to在清单文件中,我们将 @integer/version 和 app id 做到了

manifest显现

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.zapps.medical.dictionary.offlinefree"
    android:versionCode="5"
    android:versionName="2.3">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

     <!-- <uses-sdk android:minSdkVersion="8"
        android:targetSdkVersion="27" />-->

    <application
        android:icon="@drawable/icon_a"
        android:label="@string/app_name"
        android:theme="@style/LightThemeSelector">

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-6534443061196093~8744226621"/>

        <activity
            android:name=".splashscreen"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Dictionary"
            android:label="@string/app_name"/>

        <activity
            android:name=".BookMarkedWords"
            android:label="Favourites"
            android:parentActivityName=".Dictionary" />
        <activity
            android:name=".About"
            android:label="About"
            android:parentActivityName=".Dictionary" />
        <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>

</manifest>

this is the gradle file that i change the version but still not working这是 gradle 文件,我更改了版本但仍然无法正常工作

gradle gradle

    //noinspection GradleCompatible
    apply plugin: 'com.android.application'
    android {
        signingConfigs {
            config {
            }
        }
        compileSdkVersion 26
        buildToolsVersion '28.0.3'
        defaultConfig {
            applicationId 'com.zapps.medical.dictionary.offlinefree'
            minSdkVersion 15
            targetSdkVersion 26
            versionCode 4
            versionName "2.1"
            compileOptions {
                sourceCompatibility JavaVersion.VERSION_1_5
                targetCompatibility JavaVersion.VERSION_1_5
            }
        }

    buildTypes {
        release {

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        //noinspection GradleCompatible
        implementation 'com.android.support:appcompat-v7:26.0.0'
        //implementation 'com.google.android.gms:play-services:7.0.0'
        implementation 'com.google.android.gms:play-services-ads:7.0.0'

    }
    productFlavors {
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

then the app will publish on play store then it will take the up-to five days to publish the app on play store and when the ad-mob ads are verified with google then the real ads will shown然后该应用程序将在 Play 商店上发布,然后最多需要五天时间才能在 Play 商店上发布该应用程序,当 Ad-mob 广告通过谷歌验证时,就会显示真实的广告

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

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