tags:

views:

219

answers:

1

So I'm trying to just add a simple ad to my app using admob. I've followed the tutorial with the SDK but am getting stuck at one error.

Here's the error:

Multiple annotations found at this line:
- ERROR No resource identifier found for attribute 'secondaryTextColor' in package 
 'man.utd.headlines.man.utd'
- ERROR No resource identifier found for attribute 'primaryTextColor' in package 'man.utd.headlines.man.utd'
- ERROR No resource identifier found for attribute 'backgroundColor' in package 'man.utd.headlines.man.utd'

so I figure it must be a problem with my package name but as far as I can see everything is OK.

In my layout file I have the following:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/man.utd.headlines.man.utd"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >

But the package name seems correct:

package man.utd.headlines.man.utd;

Any ideas? It's very frustrating!

I have also checked my manifest and have tried with this package name but it still doesn't work:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="man.utd.headlines"

Any help is greatly appreciated.

UPDATE: Solved by changing package names to make them more consistant - they mnust be exactly the same in main class and manifest!

New Problem: Ads won't display!

Heres my layout file:

<?xml version="1.0" encoding="utf-8"?>

<WebView
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

 <com.admob.android.ads.AdView 
    android:id="@+id/ad"
    android:layout_width="fill_parent"
    android:layout_height="100px"
    myapp:backgroundColor="#000000"
    myapp:primaryTextColor="#FFFFFF"
    myapp:secondaryTextColor="#CCCCCC" />

Any ideas? Any help greatly appreciated :).

+1  A: 

Does your attrs.xml(in res/values folder) file look like this:

  <?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>

If not, create an xml file names attrs.xml in your res/values folder and copy this code into it.

magicman
Thanks for the reply, I solved the problem but have a new one, see edit! Any help is greatly appreciated.
I need this sorted ASAP so if anyone would be available for hire to correct this then I don't mind spending a small amount of $$ to get this working.
change android:layout_height="100px"to android:layout_height="wrap_content"and see if that works
magicman