Android Studio Using private resources

1

I just installed the Android Studio and the following problem occurs when you start and select a basic model because it should show you the Hello World! typical you already know, it does not show it and also indicates the following error:

  

The resource @ string / appbar_scrolling_view_behavior is marked as private in com.android.support:design Private resources should not be referenced; the may not be present everywhere, and even where they are they may disappear without notice. To fix this, copy the resource into your own project instead.

The truth has been around the network for a while and I can not find the solution ... if someone can guide me, it is to be appreciated.

    
asked by R-- 25.07.2018 в 12:49
source

1 answer

0

Regarding the error, it is definitely not a solution to delete the "@" in:

@string/appbar_scrolling_view_behavior 

since it can cause problems in your application, since it will not find the resource and will think when compiling that it is an attribute.

  

Do you really need this string that you reference in your   "Hello World" application?

This resource is used in a library, the best option you can copy it to your project, even this is what the error message suggests.

Checking a bit, this resource is located within the design library, so add your entry%% of your project to%:

<string name="appbar_scrolling_view_behavior" translatable="false">android.support.design.widget.AppBarLayout$ScrollingViewBehavior</string>

To thus have the resource in your project and avoid the error.

Check the official documentation about Private Resources.

Another option is to disable the analysis for resources marked as private, this within your values.xml , although it does not ensure the correct functioning of your application:

android {
    lintOptions {
        disable 'PrivateResource'
    } 
}
    
answered by 25.07.2018 / 17:43
source