diff --git a/docs/html/images/tools/sdk-manager-support-libs.png b/docs/html/images/tools/sdk-manager-support-libs.png new file mode 100644 index 0000000000000..37968005c789e Binary files /dev/null and b/docs/html/images/tools/sdk-manager-support-libs.png differ diff --git a/docs/html/tools/support-library/features.jd b/docs/html/tools/support-library/features.jd new file mode 100644 index 0000000000000..a749a36214447 --- /dev/null +++ b/docs/html/tools/support-library/features.jd @@ -0,0 +1,249 @@ +page.title=Support Library Features + +@jd:body + +
The Android Support Library package contains several individual libraries that can be included + in your application. Each of these libraries supports a specific range of Android platform + versions and set of features.
+ +This guide explains the important features and version support provided by the Support + Libraries, to help you decide which of them you should include in your application. In general, + we recommend including the v4 support and v7 + appcompat libraries in your application, because they support a wide range of + Android versions and provide APIs for recommended user interface patterns.
+ +In order to use any of the following libraries, you must download the library files to your + Android SDK installation. Follow the directions for downloading the Support Libraries in + Support Library Setup to + complete this step. You must take additional steps to include a specific Support Library in + your application. See the end of each library section below for instructions on how to include + the library in your application.
+ + +This library is designed to be used with Android 1.6 (API level 4) and higher. It includes the + largest set of APIs compared to the other packages, including support for application components, + user interface features, accessibility, data handling, network connectivity, and programming + utilities. Here are a few of the key classes included in the v4 package:
+ ++ There are many other APIs included in this package. For complete, detailed information about the + v4 Support Library APIs, see the {@link android.support.v4.app android.support.v4} package in the + API reference. +
+ +This library is located in the {@code <sdk>/extras/android/support/v4/} directory after + you download the Android Support Libraries. This library does not contain user interface + resources. To include it in your application project, follow the instructions for + adding libraries without + resources.
+ +The Gradle build script dependency identifier for this library is as follows:
+ ++com.android.support:support-v4:18.0.+ ++ +
This dependency notation specifies the release version 18.0.0 or higher.
+ + + +There are several libraries designed to be used with Android 2.1 (API level 7) and higher. + These libraries provide specific feature sets and can be included in your application + independently from each other.
+ + +This library adds support for the Action + Bar user interface design pattern. +
+ +Note: + This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure + you include the v4 Support Library as part of this library's classpath. +
+ +Here are a few of the key classes included in the v7 appcompat library:
+ +This library is located in the {@code <sdk>/extras/android/support/v7/appcompat/} + directory after you download the Android Support Libraries. This library contains user + interface resources. To include it in your application project, follow the instructions for + adding libraries with + resources.
+ +The Gradle build script dependency identifier for this library is as follows:
+ ++com.android.support:appcompat-v7:18.0.+ ++ +
This dependency notation specifies release version 18.0.0 or higher.
+ + + +This library adds support for the {@link android.support.v7.widget.GridLayout} class, which + allows you to arrange user interface elements using a grid of rectangular cells. + For detailed information about the v7 gridlayout library APIs, see the + {@link android.support.v7.widget android.support.v7.widget} package in the API reference.
+ +This library is located in the {@code <sdk>/extras/android/support/v7/gridlayout/} + directory after you download the Android Support Libraries. This library contains user + interface resources. To include it in your application project, follow the instructions for + adding libraries with + resources.
+ +The Gradle build script dependency identifier for this library is as follows:
+ ++com.android.support:gridlayout-v7:18.0.+ ++ +
This dependency notation specifies release version 18.0.0 or higher.
+ + +This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support + for the Fragment user interface pattern + with the ({@link android.support.v13.app.FragmentCompat}) class and additional fragment support + classes For more information about fragments, see the + Fragments developer guide. For detailed + information about the v13 Support Library APIs, see the {@link android.support.v13.app + android.support.v13} package in the API reference. +
+ +This library is located in the {@code <sdk>/extras/android/support/v13/} directory after + you download the Android Support Libraries. This library does not contain user interface + resources. To include it in your application project, follow the instructions for + adding libraries without + resources.
+ +The Gradle build script dependency identifier for this library is as follows:
+ ++com.android.support:support-v13:18.0.+ ++ +
This dependency notation specifies the release version 18.0.0 or higher.
diff --git a/docs/html/tools/extras/support-library.jd b/docs/html/tools/support-library/index.jd similarity index 66% rename from docs/html/tools/extras/support-library.jd rename to docs/html/tools/support-library/index.jd index a82a98ae4eba4..e5efb8d811575 100644 --- a/docs/html/tools/extras/support-library.jd +++ b/docs/html/tools/support-library/index.jd @@ -3,52 +3,149 @@ page.title=Support Library @jd:bodyMinimum API level supported: 4
+The Android Support Library package is a set of code libraries that provide useful and important + features for Android applications in addition to the framework APIs. These libraries provide + backward-compatible versions of framework APIs as well as features that are only available + through its API. Each Support Library is backward-compatible to a specific Android API level. + This design means that your applications can use the libraries' features and still be compatible + with devices running Android 1.6 (API level 4) and up.
-The Support Package includes static "support libraries" that you can add to your Android -application in order to use APIs that are either not available for older platform versions or that -offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your -development by offering more APIs that you can bundle with your application so you can -worry less about platform versions.
- -Note: The Support Package includes more than one support -library. Each one has a different minimum API level. For example, one library requires API -level 4 or higher, while another requires API level 13 or higher (v13 is a superset of v4 and -includes additional -support classes to work with v13 APIs). The minimum version is indicated -by the directory name, such as {@code v4/} and {@code v13/}.
+This guide provides information about what features are enabled by the different libraries, + how to use them in your development environment and information about the Support Library + releases.
-The sections below provide notes about successive releases of -the Support Package, as denoted by revision number.
+Including the Support Libraries in your Android project is considered a best practice for + application developers. Using the features they provide can help you improve the look of your + application, increase performance and broaden the reach of your application to more users. + If you use the Android + code template tools, you will notice that + all the Android application templates include one or more of the Support Libraries by default.
+ +The Support Libraries each target a base Android API level and each provides a different set + of features. In order to effectively use the libraries, it is important to consider what features + you want to support and understand what features are supported by each library at what Android + API level. To get started, review the + Support Library Features guide. + After that, go to the + Support Library Setup topic to + learn how to incorporate the Support Libraries into your application. For more details + about Support Library APIs, see the {@link android.support.v4.app android.support} + packages in the API reference.
+ + +This section provides details about the Support Library package releases.
Support Package, revision 13 (May 2013)
+/>Android Support Library, revision 18 (July 2013)
+
+
Android Support Library, revision 13 (May 2013)
Support Package, revision 12 (February 2013)
+/>Android Support Library, revision 12 (February 2013)
Support Package, revision 11 (November 2012)
+/>Android Support Library, revision 11 (November 2012)
Support Package, revision 10 (August 2012)
+/>Android Support Library, revision 10 (August 2012)
Support Package, revision 9 (June 2012)
+/>Android Support Library, revision 9 (June 2012)
Support Package, revision 8 (April 2012)
+/>Android Support Library, revision 8 (April 2012)
Support Package, revision 7 (March 2012)
+/>Android Support Library, revision 7 (March 2012)
Support Package, revision 6 (December 2011)
+/>Android Support Library, revision 6 (December 2011)
Support Package, revision 5 (December 2011)
+/>Android Support Library, revision 5 (December 2011)
Support Package, revision 4 (October 2011)
+/>Android Support Library, revision 4 (October 2011)
Compatibility Package, revision 3 (July 2011)
+/>Android Support Library, revision 3 (July 2011)
Compatibility Package, revision 2 (May 2011)
+/>Android Support Library, revision 2 (May 2011)
Compatibility Package, revision 1 (March 2011)
+/>Android Support Library, revision 1 (March 2011)
Initial release with the v4 library.
The Support Package is provided as a downloadable package from the Android SDK -Manager. To install:
- -From Eclipse, you can select Window -> Android SDK Manager. Or, launch {@code SDK Manager.exe} from -the {@code <sdk>/} directory (on Windows only) or {@code android} from the {@code -<sdk>/tools/} directory.
When done, all files (including source code, samples, and the JAR files) are saved
-into the <sdk>/extras/android/support/ directory. This directory contains
-each of the different support libraries, such as the library for API level 4 and up and the library
-for API level 13 and up, each named with the respective version (such as {@code v4/}).
To add one of the libraries to your Android project:
-- For example, the library that supports API level 4 and up is located at - {@code <sdk>/extras/android/support/v4/android-support-v4.jar}. -
-- Your build system may expect to find the JAR file in a directory other than - {@code libs}. Read the documentation for your build system to learn where to put the - JAR file. -
-- To confirm that you've added the JAR file to the correct directory and added it to the build - path: -
-Your application is now ready to use the library APIs. All the -provided APIs are available in the {@code android.support} package (for -example, {@code android.support.v4}).
- -Tip: To see the library APIs in action, take a look at the sample -apps in {@code <sdk>/extras/android/support/<version>/samples/}.
- -Warning: Be certain that you not confuse the standard -{@code android} packages with those in {@code android.support} library. Some code completion tools -might -get this wrong, especially if you're building against recent versions of the platform. To be safe, -keep your build target set to the same version as you have defined for your {@code android:minSdkVersion} -and double check the import statements for classes that also exist in the support library, such as -{@code SimpleCursorAdapter}.
- - -The support library for v4 provides access to several classes introduced with Android 3.0 and -beyond, plus some updated version of existing classes, and even some APIs that currently don't -exist in the Android platform. Some of the most useful and notable classes that have -counterparts in the v4 support library are:
- -For each of the classes above (and others not listed), the APIs work almost exactly the same -as the counterparts in the latest Android platform. Thus, you can usually refer to -the online documentation for information about the supported APIs. There are some -differences, however. Most notably:
- -
-public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.options, menu);
- MenuCompat.setShowAsAction(menu.findItem(R.id.action_search), 1);
- return true;
-}
-
-Also see the Action Bar -Compatibility sample for a demonstration of how to use {@link android.app.ActionBar} on Android -3.0+ and also support action bar functionality on older versions.
-Tip: To enable the Holographic theme on devices -running Android 3.0 or higher, declare in your manifest file that your application targets -API level 11, for example:
--<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" /> --
This way, your application automatically receives the Holographic theme and the Action Bar for -each activity when running on Android 3.0 and higher.
-For more information about how you can optimize your application for the latest -Android-powered devices, read Supporting Tablets and Handsets.
- - -The reference documentation for the Support Packages is included as part of the Android -online developer documentation:
- - - - -If you want to see some code that uses the support libraries, samples are included with the -Support Package, inside each support library directory, for example; {@code -<sdk>/extras/android/support/v4/samples/}. You can also view these samples as part of the -Android online developer documentation:
- - - -Additionally, the Google I/O App is a complete -application that uses the v4 support library to provide a single APK for both handsets and tablets -and also demonstrates some of Android's best practices in Android UI design.
- diff --git a/docs/html/tools/support-library/setup.jd b/docs/html/tools/support-library/setup.jd new file mode 100644 index 0000000000000..a2ece159f3419 --- /dev/null +++ b/docs/html/tools/support-library/setup.jd @@ -0,0 +1,308 @@ +page.title=Support Library Setup + +@jd:body + + +How you setup the Android Support Libraries in your development project depends on what features + you want to use and what range of Android platform versions you want to support with your + application.
+ +This document guides you through downloading the Support Library package and adding libraries + to your development environment.
+ + +The Android Support Library package is provided as a supplemental download to the Android SDK + and is available through the Android + SDK Manager. Follow the + instructions below to obtain the Support Library files. +
+ +To download the Support Library through the SDK Manager:
+ ++ Note: If you're developing with Android Studio, select and install the + Android Support Repository item instead. +
+
+Figure 1. The Android SDK Manager with the +Android Support Library selected.
+ +After downloading, the tool installs the Support Library files to your existing Android SDK + directory. The library files are located in the following subdirectory of your SDK: + {@code <sdk>/extras/android/support/} directory.
+ + +Before adding a Support Library to your application, decide what features you want to include + and the lowest Android versions you want to support. For more information on the features + provided by the different libraries, see + Support Library Features.
+ + +In order to use a Support Library, you must modify your application's project's + classpath dependencies within your development environment. You must perform this procedure for + each Support Library you want to use.
+ +Some Support Libraries contain resources beyond compiled code classes, such as images or XML + files. For example, the v7 + appcompat and v7 gridlayout + libraries include resources.
+ +If you are not sure if a library contains resources, check the + Support Library Features page. + The following sections describe how to add a Support Library with or without resources to your + application project.
+ + +To add a Support Library without resources to your application project:
+ +
+dependencies {
+ ...
+ compile "com.android.support:support-v4:18.0.+"
+}
+
+ To add a Support Library with resources to your application project:
+ +Create a library +project based on the support library code:
+ +<sdk>/extras/android/support/v7/appcompat/..jar files you just
+ added to the build path, so they are available to projects that depend on this library
+ project. For example, the {@code appcompat} project requires you to export both the
+ {@code android-support-v4.jar} and {@code android-support-v7-appcompat.jar} files.You now have a library project for your selected Support Library that you can use with one or + more application projects.
+ +Add the library to your application project:
+
+dependencies {
+ ...
+ compile "com.android.support:appcompat-v7:18.0.+"
+}
+
+ Support Library classes that provide support for existing framework APIs typically have the
+ same name as framework class but are located in the android.support class packages,
+ or have a *Compat suffix.
Caution: When using classes from the Support Library, be certain you import + the class from the appropriate package. For example, when applying the {@code ActionBar} + class:
++ Note: After including the Support Library in your application project, we + strongly recommend using the + ProGuard tool to prepare your application APK + for release. In addition to protecting your source code, the ProGuard tool also removes unused + classes from any libraries you include in your application, which keeps the download size of + your application as small as possible. For more information, see + ProGuard. +
+ +Further guidance for using some Support Library features is provided in the Android developer + training classes, + guides + and samples. For more information about the individual Support Library classes and methods, see + the {@link android.support.v4.app android.support} packages in the API reference. +
+ + +If you are increasing the backward compatibility of your existing application to an earlier
+ version of the Android API with the Support Library, make sure to update your application's
+ manifest. Specifically, you should update the android:minSdkVersion
+ element of the
+ <uses-sdk> tag in the manifest to the new, lower version number, as
+ shown below:
+ <uses-sdk + android:minSdkVersion="7" + android:targetSdkVersion="17" /> ++ +
This change tells Google Play that your application can be installed on devices with Android + 2.1 (API level 7) and higher.
+ +
+ Note: If you are including the v4 support and v7 appcompat libraries in your
+ application, you should specify a minimum SDK version of "7" (and not
+ "4"). The highest support library level you include in your application determines
+ the lowest API version in which it can operate.
+
Each Support Library includes code samples to help you get started using the support +APIs. The code is included in the download from the SDK Manager and is placed inside the Android +SDK installation directory, as listed below:
+ +