2

I'm moving my Android projects to Maven, and I'm having problems with one that uses AdMob.

I've installed the AdMob jar to my own repository, can build and deploy the app and ads are shown as expected. However, that is only if I delete the following three lines from my layout.xml (the AdView tag in partiular):

myappname:backgroundColor="#000000"
myappname:primaryTextColor="#FFFFFF"
myappname:secondaryTextColor="#CCCCCC"/>

If the lines are there, I get the following error messages in logcat:

[INFO] /home/futlib/Projects/myappname/myappname-free/res/layout/main.xml:9: error: No resource identifier found for attribute 'backgroundColor' in package 'com.example.myappname'
[INFO] /home/futlib/Projects/myappname/myappname-free/res/layout/main.xml:9: error: No resource identifier found for attribute 'primaryTextColor' in package 'com.example.myappname'
[INFO] /home/futlib/Projects/myappname/myappname-free/res/layout/main.xml:9: error: No resource identifier found for attribute 'secondaryTextColor' in package 'com.example.myappname'
[ERROR] Error when generating sources.

I'm not really sure why it works without these lines, but according to the resources I can find about AdMob, they should be there, so I'm wondering how I can make them work.

The very same project works in Eclipse, just not on the Maven command line. In case you're wondering, this is what my res/values/attrs.xml looks like:

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

Any ideas?

futlib
  • 8,258
  • 13
  • 40
  • 55

1 Answers1

0

Try adding the AdMob sdk to your build dependencies as described in this answer. Alternatively you might want to check out this answer.

Community
  • 1
  • 1
Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
  • The first answer describes how to add AdMob to Maven, I already did that. The second answer doesn't seem to relate to my problem. Note that the ads are shown, just that I can't set those parameters. Also note that the Maven project uses the _exact_ same AdMob JAR as the Eclipse project - where everything worked. – futlib Jun 08 '11 at 17:07