So there I have a color defined as an attribute because it is dependent on the theme.

```
<attr name="primary_text_color" format="color"/>

```

It is defined in the theme as 

```
<style name="BaseReferencesTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="primary_text_color">#ffffffff</item>
</style>

```

I'd like to wrap it with a real color resource.

```
<color name="selected_color_normal">?attr/primary_text_color</color>

```

And then read it from code

```
int resolvedColor = ContextCompat.getColor(context, R.color.selected_color_normal);

```

When I do this, I am getting an exception

```
 android.content.res.Resources$NotFoundException: Resource ID #0x7f06010e type #0x2 is not valid
        at android.content.res.Resources.getColor(Resources.java:955)
        at android.content.Context.getColor(Context.java:588)
        at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:523)

```

There are a few modules here I work with:

1. `attr_module` where the attributes are defined.
2. `theme_module` where the theme is defined and set to the application
3. `usage_module` which knows nothing about the theme, but does depend on the `attr_module`.

I know for sure that the theme is applied to the views in the `usage_module`. All the dependencies are set correctly, when I do not try to programmatically read `selected_color_normal`, but just applying the attribute - everything is working.

Thanks for any help!