天天看點

android.support library找不到的解決方法

the support package is provided as a downloadable package from the android sdk manager. to install:

launch the android sdk manager.

from eclipse, you can select window &gt; android sdk manager. or, launch <code>sdk manager.exe</code> from the <code>&lt;sdk&gt;/</code> directory (on windows only) or <code>android</code> from the <code>&lt;sdk&gt;/tools/</code> directory.

expand the android repository, check android support package and click install selected.

proceed to install the package.

when done, all files (including source code, samples, and the <code>.jar</code> files) are saved into the<code>&lt;sdk&gt;/extras/android/support/</code> 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/</code>).

to add one of the libraries to your android project:

in your android project, create a directory named <code>libs</code> at the root of your project (next to <code>src/</code>, <code>res/</code>, etc.)

locate the jar file for the library you want to use and copy it into the <code>libs/</code> directory.

for example, the library that supports api level 4 and up is located at<code>&lt;sdk&gt;/extras/android/support/v4/android-support-v4.jar</code>.

add the jar to your project build path.

in eclipse, right-click the jar file in the package explorer, select build path &gt; add to build path.

your application is now ready to use the library apis. all the provided apis are available in the <code>android.support</code>package (for example, <code>android.support.v4</code>).

tip: to see the library apis in action, take a look at the sample apps in<code>&lt;sdk&gt;/extras/android/support/&lt;version&gt;/samples/</code>.

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:

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:

this way, your application automatically receives the holographic theme and the action bar for each activity when running on android 3.0 and higher.

the reference documentation for the support packages is included as part of the android online developer documentation:

<a href="http://developer.android.com/reference/android/support/v4/app/package-summary.html">support package api 4 reference</a>

<a href="http://developer.android.com/reference/android/support/v13/app/package-summary.html">support package api 13 reference</a>

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>&lt;sdk&gt;/extras/android/support/v4/samples/</code>. you can also view these samples as part of the android online developer documentation:

<a href="http://developer.android.com/resources/samples/support4demos/index.html">support api 4 demos</a>

<a href="http://developer.android.com/resources/samples/support13demos/index.html">support api 13 demos</a>

歡迎加群互相學習,共同進步。qq群:ios: 58099570 | android: 330987132 | go:217696290 | python:336880185 | 做人要厚道,轉載請注明出處!http://www.cnblogs.com/sunshine-anycall/archive/2013/02/21/2919882.html

繼續閱讀