- بنية الجملة:
-
<uses-native-library android:name="string" android:required=["true" | "false"] />
- مضمّنة في:
-
<application>
- description:
-
تحدّد هذه السمة مكتبة أصلية مشترَكة يوفّرها المورّد يجب ربط التطبيق بها. يطلب هذا العنصر من النظام إتاحة الوصول إلى المكتبة الأصلية للحزمة.
يمكن الوصول إلى مكتبات NDK تلقائيًا، وبالتالي لا تتطلّب العلامة
<uses-native-library>
.لا يمكن الوصول تلقائيًا إلى المكتبات المشترَكة المجمّعة من رموز برمجية أصلية غير التابعة لحزمة NDK والتي يوفّرها مورّدو شرائح السيليكون أو مصنّعو الأجهزة، وذلك إذا كان التطبيق يستهدف الإصدار 12 من نظام التشغيل Android (المستوى 31 لواجهة برمجة التطبيقات) أو الإصدارات الأحدث. ولا يمكن الوصول إلى المكتبات إلا عند طلبها صراحةً باستخدام العلامة
<uses-native-library>
.إذا كان التطبيق يستهدف الإصدار 11 من نظام التشغيل Android (المستوى 30 لواجهة برمجة التطبيقات) أو إصدارًا أقدم، لن تكون العلامة
<uses-native-library>
مطلوبة. في هذه الحالة، يمكن الوصول إلى أي مكتبة مشتركة أصلية بغض النظر عمّا إذا كانت مكتبة NDK أم لا.يؤثّر هذا العنصر أيضًا في تثبيت التطبيق على جهاز معيّن. في حال توفّر هذا العنصر وضبط سمة
android:required
علىtrue
، لن يسمح إطار عملPackageManager
للمستخدم بتثبيت التطبيق ما لم تكن المكتبة متوفّرة على جهاز المستخدم.يتم وصف السمة
android:required
بالتفصيل في القسم التالي. - السمات:
-
android:name
- تمثّل هذه السمة اسم ملف المكتبة.
android:required
-
قيمة منطقية تشير إلى ما إذا كان التطبيق يتطلّب المكتبة المحدّدة بواسطة
android:name
.-
"true"
: لا يمكن تشغيل التطبيق بدون هذه المكتبة. لا يسمح النظام بتثبيت التطبيق على جهاز لا يتضمّن المكتبة. -
"false"
: يستخدم التطبيق المكتبة إذا كانت متوفّرة، ولكنّه مصمَّم للعمل بدونها إذا لزم الأمر. يسمح النظام بتثبيت التطبيق حتى إذا لم تكن المكتبة متوفّرة. في حال استخدام"false"
، تكون أنت المسؤول عن التعامل مع عدم توفّر المكتبة بشكل سليم.
القيمة التلقائية هي
"true"
. -
- تم إدخال القدرة لأول مرة في:
- المستوى 31 من واجهة برمجة التطبيقات
- راجِع أيضًا:
<uses-authorized-library>
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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)"]]