当我按照说明通过 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
文件,但编译器不喜欢它。
最佳答案
在自定义布局 nampespace 中将 /res/
替换为 /lib/
。
xmlns:android="http://schemas.android.com/apk/res/android"
在你的情况下,将是:
xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"
关于android - 错误 : No resource identifier found for attribute 'adSize' in package 'com.google.example' main. XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41594756/