- sintaxis:
-
<uses-native-library android:name="string" android:required=["true" | "false"] />
- se incluye en:
-
<application>
- descripción:
-
Especifica una biblioteca nativa compartida por el proveedor con la que se debe vincular la aplicación. Este elemento le indica al sistema que haga que la biblioteca nativa sea accesible para el paquete.
Se puede acceder a las bibliotecas del NDK de forma predeterminada y, por lo tanto, no requieren la etiqueta
<uses-native-library>
.De forma predeterminada, no se puede acceder a las bibliotecas nativas compartidas que no pertenecen al NDK que proporcionan proveedores de silicio o fabricantes de dispositivos si la app se orienta a Android 12 (nivel de API 31) o versiones posteriores. Solo se puede acceder a las bibliotecas cuando se solicitan de manera explícita con la etiqueta
<uses-native-library>
.Si la app se orienta a Android 11 (nivel de API 30) o versiones anteriores, no se requiere la etiqueta
<uses-native-library>
. En ese caso, se puede acceder a cualquier biblioteca nativa compartida, independientemente de si es una biblioteca de NDK.Este elemento también afecta la instalación de la aplicación en un dispositivo en particular. Si este elemento está presente y su atributo
android:required
está configurado comotrue
, el frameworkPackageManager
no permitirá que el usuario instale la aplicación a menos que la biblioteca esté presente en su dispositivo.En la siguiente sección, se describe en detalle el atributo
android:required
. - atributos:
-
android:name
- Corresponde al nombre del archivo de biblioteca.
android:required
-
Es un valor booleano que indica si la aplicación requiere la biblioteca especificada por
android:name
.-
"true"
: La aplicación no funciona sin esta biblioteca. El sistema no permite que se instale la aplicación en un dispositivo que no tenga la biblioteca. -
"false"
: La aplicación usa la biblioteca si está presente, pero está diseñada para funcionar sin ella de ser necesario. El sistema permite que se instale la aplicación, incluso si la biblioteca no está presente. Si usas"false"
, eres responsable de controlar correctamente la ausencia de la biblioteca.
El valor predeterminado es
"true"
. -
- primera inclusión:
- Nivel de API 31
- consulta también:
<uses-native-library>
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-08-21 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (UTC)"],[],[],null,["# <uses-native-library\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cuses-native-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 [vendor-provided shared native library](https://source.android.com/devices/tech/config/namespaces_libraries#adding-additional-native-libraries)\n that the application must be linked against. This element tells the system to make the native\n library accessible for the package.\n\n\n NDK libraries are by default accessible and therefore don't require the\n `\u003cuses-native-library\u003e` tag.\n\n\n Non-NDK native shared libraries that are provided by silicon vendors or device manufacturers\n aren't accessible by default if the app targets Android 12 (API level 31) or higher. The\n libraries are accessible only when they are explicitly requested using the\n `\u003cuses-native-library\u003e` tag.\n\n\n If the app targets Android 11 (API level 30) or lower, the\n `\u003cuses-native-library\u003e` tag isn't required. In that case, any native shared\n library is accessible regardless of whether it is an NDK library.\n\n\n This element also affects the installation of the application on a particular device. If this\n element is present and its `android:required` attribute is set to\n `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 file.\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 gracefully handling the absence of the library.\n\n\n The default is `\"true\"`.\n\n\nintroduced in:\n: API level 31\n\nsee also:\n:\n - [PackageManager](/reference/android/content/pm/PackageManager)\n - [\u003cuses-library\u003e](/guide/topics/manifest/uses-library-element)\n [](/guide/topics/manifest/uses-library-element)\n\n [](/guide/topics/manifest/uses-library-element)\n[](/guide/topics/manifest/uses-library-element)"]]