question

ez4nick avatar image
ez4nick asked

Amazon namespace for xml layout

I am trying to include the ads by making them part of my xml layout, I noticed on this quickstart guide: https://developer.amazon.com/sdk/mobileads/quick-start.html it says that you should have the namespace as "xmlns:Amazon=" http://schemas.android.com/apk/res/ "". However when I tried this intelij says that the namepace is never used and the ad never shows up in the layout. I looked in the sample provided in the sdk and for their namespace they didn't use their package name but instead: "xmlns:Amazon=" http://schemas.android.com/apk/lib/com.amazon.device.ads"". So I am wondering what the correct namepace is that I should be using
mobile ads
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi ez4nick, Thank you for posting. With the current sdk below is the correct namespace declaration. xmlns:Amazon=" http://schemas.android.com/apk/lib/com.amazon.device.ads" This will be needed when you specify property of com.amazon.device.ads.AdLayout from xml layout definition. e.g Amazon:adSize="300x250" as described here : https://developer.amazon.com/sdk/mobileads/understanding-api.html#Manual%20Ad%20Size If you are using the externalized property in xml like "Amazon:adSize" and not mentioning the correct namespace in it or it's parent view, it would cause build failure by giving below error android-apt-compiler: [SimpleAdSample] ~\Apps-SDK\Android\Ads\samples\SimpleAdSample\res\layout\main.xml:11: error: No resource identifier found for attribute 'adSize' in package 'com.amazon.sample.simplead' But in your case ad does not appear in the screen. The problem must be different. Are you trying to run "SimpleAdSample" comes with sdk with the application key "sample-app-v1_pub-2". Or using your own app key? To use your own key you should go through : https://developer.amazon.com/sdk/mobileads/quick-start.html#Before%20You%20Use%20the%20Amazon%20Mobile%20Ads%20API Do you see any error code in the logcat? The error codes are discussed here : https://developer.amazon.com/sdk/mobileads/event-tracking-and-errors.html#Errors
10 |5000

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

ez4nick avatar image
ez4nick answered
Thanks for the information. I was able to discover that adding the namespace wasn't necessary in my xml file because I was not setting an ad size. That did solve my issue but lead to another issue. I am using InteliJ and in the xml layout preview does not show where the ad is in the layout but it does list it as a component. I am not sure how I can view it to place it as desired in my layout
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi ez4nick, To test the layout in the intellij in design mode you could set background color and hard code the layout_width and layout_height according to the values you are mentioning in the Amazon:adSize. e.g. Please remove the background and hard code when you are sure how it would look like with the real ad display. Good to know that your older problem is solved.
10 |5000

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