Marked as private warning after changing colour of up arrow

It seems it's a bug in android this post form a project member in Android Open Source Project - Issue Tracker

Replying to a similar Issue

The root cause here is that when a library depends on another library, it imports all the resources from any libraries it depends on into its own declared R.txt (in the AAR file).

However, it doesn't include the public.txt declaration from those dependencies, so now it ends up exposing these symbols as declared but not public -- e.g. private.

I'm considering two fix alternatives:

(1) in the resource visibility lookup for a library, remove any symbols imported from a dependency (whether or not that dependency provides visibility information), or

(2) reverse the visibility lookup logic: if we find a symbol as public in any library, consider it public rather than the current logic which says that if a symbol is declared as private anywhere, it is.

I think I'm going with 2; the current logic doesn't make sense when considering the scenario that symbols end up inlined in downstream libraries.

as they said :

The only workaround for now is to turn off the private resource lint check:

    android {
        lintOptions {
            disable 'PrivateResource'
        } 
    }

they are saying it was fixed but I had run through this issue today and I'm using android studio 1.5.1 and gradle 1.5


Instead of doing Mohammad's

android {
    lintOptions {
        disable 'PrivateResource'
    } 
}

I'd recommend to do the following, which is a local fix for a statement. The advantage is not having to deactivate the lint-checks globally (which can easily be forgotten to activate again later on).

For XML:

tools:ignore="PrivateResource"

For Code:

@SuppressLint("PrivateResource")

Effectively, your code then should look something like this:

XML:

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
    tools:ignore="PrivateResource" />

Code:

@SuppressLint("PrivateResource")
final Drawable upArrow = ContextCompat.getDrawable(context, R.drawable.abc_ic_ab_back_mtrl_am_alpha);

See Choose resources to make public for the reason.

In short, drawable/abc_ic_ab_back_mtrl_am_alpha is a private resource of appcompat-v7 and is intended to be used only by that library. You should not use it.

If you really want to use it, copy it to your project