<uses-library>
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Observação: o Google Play usa os elementos <uses-library>
declarados
no manifesto para filtrar o app dos dispositivos que não atendem aos
requisitos da biblioteca. Para mais informações sobre filtros, consulte
Filtros no Google Play.
- Sintaxe:
-
<uses-library
android:name="string"
android:required=["true" | "false"] />
- contido em:
-
<application>
- descrição:
-
Especifica uma biblioteca compartilhada que precisa ser vinculada ao aplicativo.
Esse elemento instrui o sistema a incluir o código da biblioteca no carregador
de classes do pacote.
Todos os pacotes android
, como android.app
,
android.content
, android.view
e android.widget
,
estão na biblioteca padrão com que todos os aplicativos são automaticamente
vinculados. No entanto, alguns pacotes, como maps
, estão
em bibliotecas separadas, que não são vinculadas automaticamente. Consulte a
documentação dos pacotes que você está usando para determinar qual biblioteca
contém o código do pacote.
A ordem das tags <uses-library>
é significativa. Ela afeta a pesquisa de classes
e a ordem de resolução quando o aplicativo é carregado. Algumas das bibliotecas podem ter
classes duplicadas e, nesse caso, a biblioteca que vem primeiro tem prioridade.
Esse elemento também afeta a instalação do aplicativo em dispositivos específicos e
a disponibilidade do app no Google Play. Se este elemento estiver presente e o
atributo android:required
estiver definido como "true"
, o
framework de PackageManager
não vai permitir que o usuário instale o aplicativo, a menos que a biblioteca esteja presente no
dispositivo do usuário.
O atributo android:required
é descrito em detalhes na próxima seção.
- atributos:
-
android:name
-
O nome da biblioteca. O nome é fornecido pela
documentação do pacote que você está usando. Um exemplo é o
"android.test.runner"
, um pacote que contém classes de teste
do Android.
android:required
-
Valor booleano que indica se o aplicativo exige a
biblioteca especificada por
android:name
.
O padrão é "true"
.
Introduzido no nível 7 da API.
- introduzido em:
- Nível 1 da API
- veja também:
-
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-07-27 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-07-27 UTC."],[],[],null,["# <uses-library\u003e\n\n**Note:** Google Play uses the `\u003cuses-library\u003e` elements declared\nin your app manifest to filter your app from devices that don't meet its\nlibrary requirements. For more information about filtering, see\n[Filters on Google Play](/google/play/filters).\n\nsyntax:\n:\n\n ```xml\n \u003cuses-library\n android:name=\"string\"\n android:required=[\"true\" | \"false\"] /\u003e\n ```\n\ncontained in:\n:\n `\n `[\u003capplication\u003e](/guide/topics/manifest/application-element)`\n `\n\ndescription:\n\n:\n Specifies a shared library that the application must be linked against.\n This element tells the system to include the library's code in the class\n loader for the package.\n\n\n All the `android` packages, such as [android.app](/reference/android/app/package-summary),\n [android.content](/reference/android/content/package-summary), [android.view](/reference/android/view/package-summary), and [android.widget](/reference/android/widget/package-summary),\n are in the default library that all applications are automatically linked\n against. However, some packages, such as `maps`, are\n in separate libraries that aren't automatically linked. Consult the\n documentation for the packages you're using to determine which library\n contains the package code.\n\n\n The order of `\u003cuses-library\u003e` tags is significant. It affects class lookup\n and resolution order when the application loads. Some of the libraries might have\n duplicate classes, and in that case the library that comes first takes priority.\n\n\n This element also affects the installation of the application on a particular device and\n the availability of the application on Google Play. If this element is present and its\n `android:required` attribute is set to `\"true\"`, the\n [PackageManager](/reference/android/content/pm/PackageManager)\n framework won't let a user install the application unless the library is present on the\n user's device.\n\n\n The `android:required` attribute is described in detail in the following section.\n\nattributes:\n:\n\n `android:name`\n :\n The name of the library. The name is provided by the\n documentation for the package you are using. An example of this is\n `\"android.test.runner\"`, a package that contains Android test\n classes.\n\n `android:required`\n :\n Boolean value that indicates whether the application requires the\n library specified by `android:name`.\n\n - `\"true\"`: the application doesn't function without this library. The system doesn't let the application install on a device that doesn't have the library.\n - `\"false\"`: the application uses the library if present, but is designed to function without it if necessary. The system lets the application install, even if the library isn't present. If you use `\"false\"`, you are responsible for checking at runtime that the library is available.\n\n\n To check for a library, you can use reflection to determine\n whether a particular class is available.\n\n\n The default is `\"true\"`.\n\n Introduced in: API level 7.\n\n\nintroduced in:\n: API Level 1\n\nsee also:\n:\n - [PackageManager](/reference/android/content/pm/PackageManager)"]]