error: No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml

Replace /res/ with /lib/ in your custom layout nampespace.

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

in your case, would be:

xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"

I hope it helps.


I had the same problem. I copied the example code from Google code, and could not compile.

xmlns:ads="http://schemas.android.com/apk/res/com.google.example"

Finally, I figured it out. The last part of the code "com.google.example", is their package name, so you need to replace it with your project package.

For example, my project package is "com.jms.AdmobExample", so my ads naming space is:

xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"

Check my example, it works fine. You can download the APK to try. I also put my source code here: Add Google Admob in Android Application


for me, I have to add

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

right after:

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

in res/layout/main.xml