When I followed the instructions to add an ad into my app by xml, I got the following errors:
Description Resource Path Location Type
error: No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml /HelloWorld/res/layout line 12 Android AAPT Problem
Description Resource Path Location Type
error: No resource identifier found for attribute 'adUnitId' in package 'com.google.example' main.xml /HelloWorld/res/layout line 12 Android AAPT Problem
I did edit the main.xml
, add attrs.xml
file but the compiler didn't like it.
I added in android.support.design.widget.NawigationView this parameter:
And problem was solved.
Make Sure you have included this part in your layout (top below xmlns:android line)
Also Check whether you have included attrs.xml in the res/values/
Check here for more details. http://code.google.com/mobile/ads/docs/android/banner_xml.html
for me, I have to add
right after:
in res/layout/main.xml
I had the same problem, but while using a library project. The issue has been solved in r17: Instead of using the package's namespace:
One has to use a dummy namespace:
This will fix the problem of the attributes not being accessible from the referencing project.
Add xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads", This will solve your Issue.
I also faced the same problem, I was using
GoogleAdMobAdsSDK-4.1.0.jar
then I tried withGoogleAdMobAdsSDK-4.0.4.jar
now it is working fine, It is problem with jar file as per my experience.