Carlos Botero avatar image
Carlos Botero asked

NullPointerException from adView, trying to implement Amazon ads in Android Studio

Hi. I am trying to include Amazon ad banners in my Android App. I am following the

QuickStart Guide (

After setting the App Key, I initialize the adView variable:

this.adView = (AdLayout) findViewById(;

but the variable adView turns red with the warning: Cannot resolve symbol

So, guessing that the type of this adView variable is:,

I implement instead: adView = (AdLayout) findViewById(;
AdTargetingOptions adOptions = new AdTargetingOptions();

But if I run the code, I get: NullPointerException in:


It seems that they have been correctly instantiated, so what am I missing here?

By the way, they recommend to include the Google Play Services SDK, but the specific Google site doesn't actually specify which libraries we should add. And adding all the Play libraries seems inconvenient. I guess that they implicitly suggest to install the Play library to run Google Mobile Ads (, right?

Can you point me to a basic Android APP that actually runs Amazon banners, so I can guesstimate what is not working with my own App? Thanks

mobile adsandroidappamazon developer portal
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Ross@Amazon avatar image
Ross@Amazon answered

All the information you need to get started with Amazon Mobile Ads can be found here:

Please refer to the mobile ads sample apps included with the SDK. They are fully functioning demos of all Amazon Mobile Ad types. These samples should help you better understand how Amazon Mobile Ads are implemented. Code can be copied directly from these projects and modified as needed to quickly place ads in your app. More information regarding these sample apps can be found here:

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.