Question

I'm using the following code in xml to set my device as a test device:

<com.google.android.gms.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId="xxxxxxxxxxxxxxxx"
                         ads:testDevices="TEST_EMULATOR, xxxxxxxxx"
                         ads:adSize="BANNER"/>

I'm running into this error:

error: No resource identifier found for attribute 'testDevices' in package 'com.itspirits.lifenavigatorlite'

I'm including the ads namespace as xmlns:ads="http://schemas.android.com/apk/res-auto"

any suggestion?

Was it helpful?

Solution

The new AdMob's AdView (included in Google Play Services) doesn't have testDevices attribute in XML. Check the documentation.

You need to add your test devices in the code:

AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
adRequestBuilder.addTestDevice("xxxxxxxxx");  
adView.loadAd(adRequestBuilder.build());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top