Maven, library projects, and resources

31 views
Skip to first unread message

Erich Douglass

unread,
Mar 14, 2011, 12:27:15 PM3/14/11
to Maven Android Developers
Hey Folks,

I've been trying to get the new apklib feature to work with a library
project that I've written. The library contains some reusable widgets
(with style declarations) that I'd like to use in my main project. My
problem occurs when I try to use those styles in the main project.
Here's an example:

In the library project I have res/values/attrs.xml:

<declare-styleable name="FancyWidget">
<attr name="icon">
<enum name="foo" value="1"/>
<enum name="bar" value="2"/>
</attr>
</declare-styleable>

And I want to use this style in a layout in the main project:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:widget="http://schemas.android.com/apk/res/com.foo.main"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.foo.library.FancyWidget
widget:icon="foo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>

</LinearLayout>

However, when I run mvn compile, I get this error:

error: No resource identifier found for attribute 'icon' in package
'com.foo.main'

What's strange is that I've looked in target/generated-sources/r/com/
foo/main/R.java and the source file has a member named R.attr.icon.
Does anyone have a clue what the problem might be? Any help would be
much appreciated!
Reply all
Reply to author
Forward
0 new messages