- सिंटैक्स:
-
<uses-native-library android:name="string" android:required=["true" | "false"] />
- इसमें शामिल है:
-
<application>
- description:
-
यह वेंडर की ओर से उपलब्ध कराई गई शेयर की गई नेटिव लाइब्रेरी के बारे में बताता है. ऐप्लिकेशन को इससे लिंक करना ज़रूरी है. इस एलिमेंट से सिस्टम को यह पता चलता है कि पैकेज के लिए नेटिव लाइब्रेरी को ऐक्सेस किया जा सकता है.
एनडीके लाइब्रेरी डिफ़ॉल्ट रूप से ऐक्सेस की जा सकती हैं. इसलिए, इनके लिए
<uses-native-library>
टैग की ज़रूरत नहीं होती.अगर ऐप्लिकेशन, Android 12 (एपीआई लेवल 31) या इसके बाद के वर्शन को टारगेट करता है, तो सिलिकॉन वेंडर या डिवाइस बनाने वाली कंपनियों की ओर से उपलब्ध कराई गई, नॉन-एनडीके नेटिव शेयर की गई लाइब्रेरी डिफ़ॉल्ट रूप से ऐक्सेस नहीं की जा सकतीं. लाइब्रेरी को सिर्फ़ तब ऐक्सेस किया जा सकता है, जब
<uses-native-library>
टैग का इस्तेमाल करके साफ़ तौर पर अनुरोध किया गया हो.अगर ऐप्लिकेशन, Android 11 (एपीआई लेवल 30) या इससे पहले के वर्शन को टारगेट करता है, तो
<uses-native-library>
टैग की ज़रूरत नहीं है. ऐसे में, शेयर की गई कोई भी नेटिव लाइब्रेरी ऐक्सेस की जा सकती है. भले ही, वह NDK लाइब्रेरी हो या न हो.इस एलिमेंट से, किसी डिवाइस पर ऐप्लिकेशन इंस्टॉल करने पर भी असर पड़ता है. अगर यह एलिमेंट मौजूद है और इसका
android:required
एट्रिब्यूटtrue
पर सेट है, तोPackageManager
फ़्रेमवर्क किसी उपयोगकर्ता को ऐप्लिकेशन तब तक इंस्टॉल नहीं करने देगा, जब तक लाइब्रेरी उसके डिवाइस पर मौजूद न हो.android:required
एट्रिब्यूट के बारे में यहां ज़्यादा जानकारी दी गई है. - एट्रिब्यूट:
-
android:name
- लाइब्रेरी फ़ाइल का नाम.
android:required
-
बूलियन वैल्यू, यह बताती है कि ऐप्लिकेशन को
android:name
में बताई गई लाइब्रेरी की ज़रूरत है या नहीं.-
"true"
: इस लाइब्रेरी के बिना ऐप्लिकेशन काम नहीं करता. सिस्टम, ऐप्लिकेशन को ऐसे डिवाइस पर इंस्टॉल नहीं होने देता जिस पर लाइब्रेरी मौजूद नहीं है. -
"false"
: अगर ऐप्लिकेशन में लाइब्रेरी मौजूद है, तो उसका इस्तेमाल किया जाता है. हालांकि, अगर ज़रूरी हो, तो इसे लाइब्रेरी के बिना भी काम करने के लिए डिज़ाइन किया गया है. सिस्टम, ऐप्लिकेशन को इंस्टॉल करने की अनुमति देता है. भले ही, लाइब्रेरी मौजूद न हो."false"
का इस्तेमाल करने पर, यह आपकी ज़िम्मेदारी है कि लाइब्रेरी के मौजूद न होने पर, ऐप्लिकेशन को सही तरीके से हैंडल किया जाए.
डिफ़ॉल्ट वैल्यू
"true"
है. -
- इसकी शुरुआत हुई:
- एपीआई लेवल 31
- यह भी देखें:
<नेटिव-नेटिव-लाइब्रेरी का इस्तेमाल करें>
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-08-21 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","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-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)"]]