error: No resource identifier found for attribute #39;adSize#39; in package #39;com.google.example#39;main.xml(错误:在包“com.google.examplemain.xml 中找不到属性“adSize的资源标识符)
问题描述
当我按照说明通过 xml 将广告添加到我的应用程序时,我收到以下错误:
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
我确实编辑了 main.xml
,添加了 attrs.xml
文件,但编译器不喜欢它.
I did edit the main.xml
, add attrs.xml
file but the compiler didn't like it.
推荐答案
将自定义布局命名空间中的 /res/
替换为 /lib/
.
Replace /res/
with /lib/
in your custom layout nampespace.
xmlns:android="http://schemas.android.com/apk/res/android"
在你的情况下,将是:
xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"
希望对你有帮助.
这篇关于错误:在包“com.google.example"main.xml 中找不到属性“adSize"的资源标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!