开发者

admob error due to attrs.xml in android

开发者 https://www.devze.com 2023-02-22 22:04 出处:网络
i tried using Admob in my app by running it in a device and it showed nothing and i found the followig error in logcat

i tried using Admob in my app by running it in a device and it showed nothing and i found the followig error in logcat

04-07 10:49:05.570: ERROR/Ads(1084): AdView missing required XML attribute adUnitId. 

in attrs.xml file i have the following lines

<?xml v开发者_开发问答ersion="1.0" encoding="utf-8"?>

<declare-styleable name="com.google.ads.AdView"> 
<attr name="backgroundColor" format="color" /> 
<attr name="primaryTextColor" format="color" /> 
<attr name="secondaryTextColor" format="color" /> 
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" /> 
</declare-styleable>

What is my error...

I have totally 4 Activities in my App and i am trying to add the admob in my 4th activity. whether i have to add the above said lines with that activity or anything else pls help me friends...


Should be ( with '<'resources'>' ):

<?xml version="1.0" encoding="utf-8"?>
<resources>  
<declare-styleable name="com.admob.android.ads.AdView">
      <attr name="backgroundColor" format="color" />
      <attr name="primaryTextColor" format="color" />
      <attr name="secondaryTextColor" format="color" />
      <attr name="keywords" format="string" />
      <attr name="refreshInterval" format="integer" />
</declare-styleable>
</resources>


i followed as said here and it get worked. (long time before i asked this ques, i dint get success with any of the answer and i left it, when i tried now it works...)

0

精彩评论

暂无评论...
验证码 换一张
取 消