From 6c00399c89bf4953ef36872e6fa237afff7a6491 Mon Sep 17 00:00:00 2001 From: Rich Slogar Date: Thu, 9 Jul 2015 14:29:06 -0700 Subject: docs: studio 1.3 private resources Change-Id: Ie4260b5ef919a452507be98a70fe247589d34b93 --- docs/html/tools/studio/studio-features.jd | 60 +++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) (limited to 'docs/html/tools') diff --git a/docs/html/tools/studio/studio-features.jd b/docs/html/tools/studio/studio-features.jd index 3d5b24c..44d6985 100644 --- a/docs/html/tools/studio/studio-features.jd +++ b/docs/html/tools/studio/studio-features.jd @@ -14,6 +14,7 @@ page.tags=studio, features
  • Android Studio and Project Settings
  • Fingerprint Support
  • Developer Services
  • +
  • Public and Private Resources
  • Editor Support for the Latest Android APIs
  • Test APK Module
  • @@ -43,7 +44,8 @@ and

    Translations Editor

    Multi-language support is enhanced with the Translations Editor plugin so you can easily add a variety of locales to the app's translation file. With -BCP 47 support, the editor combines language and +BCP 47 support, the editor +combines language and region codes into a single selection for targeted localizations. Color codes indicate whether a locale is complete or still missing string translations.

    @@ -167,6 +169,61 @@ detail about starting the services, refer to each service's specific activation +

    Public and Private Resources

    +

    By default, Android Studio treats all library resources as public: A public library resource is +available to library clients for use outside the library, and appears in code completion suggestions +and other resource references. Android Studio also, however, supports the use of private library +resources. A private library resource can only be used within the source library, and does not +appear in code completion lists and other resource references.

    + +

    You cannot explicitly declare a library resource as private. Instead, if you declare any library +resources as public, Android Studio assumes all the other library resources are private.

    + +

    An app treats all Android library resources as public unless you explicitly declare at least one +resource in the library as public. Declaring one public resource causes your app to treat all other, +undeclared resources in the library as private.

    + +

    Note: Declaring public and private resources requires the +Android Plugin for Gradle version +1.3 or higher.

    + + +

    To declare a resource as public and set other undeclared resources as private, add a +<public> declaration with the resource name and type in the resource file. +This example shows the public declaration for the mylib_app_name string resource.

    + +
    +<resources>
    +    <public name="mylib_app_name" type="string"/>
    +</resources>
    +
    + +

    For large numbers of declarations, we recommended that you place the public marker declarations +in a separate file named public.xml.

    + +

    To help enforce private resource access, a lint +warning appears when a client of a library references a private resource. Many Android libraries, +such as the +Design Support Library and the +v7 appcompat Library, +declare public resources to display only resources that developers can directly reference. +

    + +

    Note: If your app requires a private resource, copy the +private resource from the library to the location in your app where it is needed.

    + +

    When the build system builds an Android Archive (AAR) file, it extracts the +<public> resource declarations into a public.txt file, which is +packaged inside the AAR file next to the R.txt file. The public.txt file +contains a simple list of the declared public resources, describing their names and types.

    + +

    For a complete list of the available Android resource types, see +Resource +Types and +More Resource +Types.

    + +

    Editor Support for the Latest Android APIs

    Android Studio supports the @@ -277,4 +334,3 @@ properties for the project path and target build type variant.

    app's build.gradle file.

    - -- cgit v1.1