错误:未找到属性“adSize”在包资源标识符“com.google.example”main.xml中标识符、未找到、属性、错误

2023-09-08 15:45:47 作者:他把我甩了

当我按照说明添加广告到由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目录/ 在自定义布局nampespace 的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android

replace /res/ with /lib/ in your custom layout nampespace xmlns:android="http://schemas.android.com/apk/res/android" will be

的xmlns:yourApp =htt​​p://schemas.android.com/apk/lib/com.yourAppPackege.yourClass

我希望它帮助:)

 
精彩推荐