Upgrading to the new Admob issues

John Jared

First, I have put this into my manifest

<activity android:name="com.google.android.gms.ads.AdActivity" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

<meta-data android:name="com.google.android.gms.version" 
    android:value="@integer/google_play_services_version"/>

Then, inside each layout I want my ads to appear in, I have put this in its .xml up

          xmlns:ads="http://schemas.android.com/apk/res-auto"

and this down

<com.google.android.gms.ads.AdView 
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adUnitId="ca-abb-psb-4557896546544844/5789887777"
    ads:adSize="BANNER"
    ads:loadAdOnCreate="true" 
    android:layout_gravity="center"
    android:layout_margin="10dp">
</com.google.android.gms.ads.AdView>    

and at last, I have imported the library google-play-services_libs

The problem now that I get error: No resource identifier found for attribute 'loadAdOnCreate' in package 'aaa.bbb.ccc' from the <com.google.android.gms.ads.AdView .... > in the xml.

And I get R cannot be resolved to a variable in all of my app classes.

AlexBcn

Look at https://developers.google.com/android/reference/com/google/android/gms/ads/AdView#xml-attributes

LoadOnCreate cannot be used anymore as XML attribute.

<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"/>

// Java code required.
// testDevices and loadAdOnCreate attributes are
// no longer available.
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Upgrading to the new Admob issues

From Dev

Upgrading to Rails 4.2 issues

From Dev

Admob legacy to New Admob in eclipse

From Dev

Issues in Upgrading Struts 2.1 to 2.3.15.1

From Dev

Upgrading Application to Rails 4 issues

From Dev

Issues after upgrading Ruby & Rails

From Dev

Issues after upgrading to Ubuntu 20.04

From Dev

Upgrading to a new release vs just upgrading the kernel

From Dev

Issues from Upgrading one version at a time?

From Dev

Autolayout issues after upgrading to xcode 7

From Dev

Issues in upgrading osgi jar from 3.8.1 to 3.10.1

From Dev

Issues while upgrading from 18.10 to 19.04

From Dev

Issues from Upgrading one version at a time?

From Dev

Trying to Request new pin on Admob

From Dev

Upgrading new PC to Win 10

From Dev

New Date().toISOString() issues

From Dev

Android new folder issues

From Dev

Javascript issues *New to programming*

From Dev

Android new folder issues

From Dev

New issues in PDO Class

From Dev

Battery Issues in new laptop

From Dev

New admob Express Native ads fail with IllegalStateException

From Dev

New admob Express Native ads fail with IllegalStateException

From Dev

AdMob GADBannerView delay when presenting new VC

From Dev

Performance issues when upgrading from ruby 1.9.3 to 2.2.2

From Dev

upgrading to iOS 7 and Xcode 5 - having issues with UIAccelerator, UIStringDrawing and NSObject

From Dev

Resolving issues while upgrading to angularjs 1.3 from 1.0.5

From Dev

Android Resource issues after upgrading to Xamarin Forms 2.0

From Dev

Layout issues with XIB in Xcode 5 (after upgrading app)