当我按照说明通过xml将广告添加到我的应用程序中时,我得到了以下错误:
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
文件,但是编译器不喜欢它。
发布于 2013-01-13 07:45:35
在您的自定义布局命名空间中,用/lib/
替换/res/
。
xmlns:android="http://schemas.android.com/apk/res/android"
在您的情况下,将是:
xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"
我希望它能帮上忙。
发布于 2011-05-01 01:45:18
我也有同样的问题。我从Google代码中复制了示例代码,但无法编译。
xmlns:ads="http://schemas.android.com/apk/res/com.google.example"
最后,我想通了。代码"com.google.example
“的最后一部分是它们的包名,因此您需要将其替换为您的项目包。
例如,我的项目包是"com.jms.AdmobExample
",所以我的ads
命名空间是:
xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"
看看我的例子,它工作得很好。您可以下载APK进行尝试。我还将我的源代码放在这里:Add Google Admob in Android Application
发布于 2012-05-14 16:16:33
对我来说,我必须补充
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
紧随其后:
xmlns:android="http://schemas.android.com/apk/res/android"
在res/layout/main.xml中
https://stackoverflow.com/questions/5819369
复制相似问题