简体   繁体   中英

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

 <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

 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

string ca-app-pub-6534443061196093/5988881403

in manifest file we did it @integer/version and app id to

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

    //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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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