تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تنقل أداة Jetifier المستقلة المكتبات المعتمدة على مكتبة الدعم إلى
بدلاً من ذلك على حزم AndroidX المكافئة. تتيح لك الأداة ترحيل
مكتبة فردية مباشرةً بدلاً من استخدام المكوّن الإضافي لنظام Gradle المتوافق مع Android
باستخدام "استوديو Android"
تثبيت Jetifier
لتثبيت Jetifier، نزِّل الملف المضغوط
ملف
واستخراج البيانات يجب تثبيت الإصدار 1.8 من Java أو الإصدارات الأحدث على جهازك.
الاستخدام
لمعالجة مكتبة، يجب تمرير المسار إلى المكتبة الحالية والمسار
الذي يجب أن تنشئها الأداة. يتوافق تطبيق Jetifier مع JAR وAAR وZIP
بما في ذلك الأرشيفات المتداخلة.
يعرض الجدول التالي الخيارات المتاحة لأوامر أداة Jetifier:
Option
هل هي مطلوبة؟
الوصف
-i، <path>--input
نعم
المسار إلى مكتبة الإدخال (JAR أو AAR أو ZIP)
-o، <path>--output
نعم
المسار إلى ملف الإخراج. إذا كان الملف
متوفّرة حاليًا، يستبدلها Jetifier.
-c، <path>--config
لا
المسار إلى ملف إعداد مخصّص اختياري.
-l، <level>--log
لا
مستوى التسجيل: القيم المسموح بها هي:
خطأ
warning
معلومات
مطوَّل
إذا لم يتم تحديده، سيتم ضبطه تلقائيًا على "تحذير".
-r
لا
التشغيل في الوضع العكسي ("إزالة التشويش").
-rebuildTopOfTree, --rebuildTopOfTree
لا
إعادة إنشاء ملف ZIP لتوزيع Maven وفقًا
ملف POM الذي تم إنشاؤه
في حال ضبط هذه السياسة، فإنّ جميع المكتبات المُعاد كتابتها
جزءًا من "مكتبة الدعم". غير مطلوب لعملية النفاذ.
-s، --strict
لا
لا تلجأ إلى اتخاذ هذا الإجراء في حال عدم توفّر القواعد. طرح الأخطاء
بدلاً من ذلك.
-stripSignatures, --stripSignatures
لا
لا تعرض رسالة خطأ عند
تنسيق مكتبة موقعة إزالة ملفات التوقيع
بدلاً من ذلك.
-t، <arg>-timestamp
لا
سياسة الطوابع الزمنية التي يجب استخدامها
الإدخالات المؤرشفة كوقت تعديلها. القيم: KeepPrevious (تلقائي)
حقبة أو الآن.
مثال
يقوم المثال التالي بتشغيل الأداة على المكتبة libraryToProcess.aar في
الدليل الحالي ويكتب الإخراج إلى result.aar بنفس
الدليل:
ينقل Jetifier مراجع Java وXML وPOM وProGuard التي تشير إلى
android.support.* حزمة، جارٍ تغييرها بحيث تشير إلى القيم المطابقة
androidx.* حزمة.
بما أنّ أحرف البدل في ProGuard للنطاق android.support.* لا يتم تعيينها دائمًا بشكل مباشر
androidx.*، ينتج Jetifier كل البدائل المؤهلة.
إذا كان هناك نوع في حزمة android.support.* لا يأتي من أي
بيانات مكتبة الدعم، سيستمر Jetifier في نقل النوع ما دام هناك
التخطيط لها. ومع ذلك، ليس من المضمون نجاح عملية النقل هذه، حيث
قد لا تكون قواعد تعيين عامة بشكلٍ كافٍ لتغطية جميع الأنواع المخصصة.
الاستخدام المتقدّم
تتوافق الأداة Jetifier مع بعض حالات الاستخدام المتقدّمة.
الوضع العكسي
إذا تجاوزت علامة -r، سيتم تشغيل الأداة في الوضع العكسي. في هذا الوضع،
تعمل على تحويل واجهات برمجة تطبيقات AndroidX إلى مكافئات مكتبة Support Library. الوضع العكسي
مفيدة إذا كنت تقوم بتطوير
المكتبات التي تستخدم واجهات برمجة تطبيقات AndroidX ولكنها تحتاج أيضًا إلى توزيع الإصدارات التي تستخدم
مكتبة الدعم.
مثال
يقوم المثال التالي بتشغيل الأداة في الوضع العكسي في المكتبة
myAndroidXLib.aar في الدليل الحالي وتكتب الإخراج إلى
supportLibVersion.aar في الدليل نفسه:
تستخدم أداة Jetifier ملف إعداد لربط فئات Support Library (مكتبة الدعم)
نظيره في AndroidX. إذا لزم الأمر، يمكنك إنشاء ملف تهيئة مخصص
تغيير هذا التعيين. ويمكنك أيضًا إضافة فئات جديدة إلى عملية الربط غير
أعضاء في مكتبة الدعم. على سبيل المثال، يمكنك تعديل
تعيين لاستبدال إحدى فئاتك بفئة لاحقة مكتوبة لاستخدامها
AndroidX.
لاستخدام ملف تهيئة مخصص:
استخرِج الملف default.generated.config من نافذة الأداة
ملف jetifier-core-*.jar واحفظه.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-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-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Jetifier\n\nThe standalone Jetifier tool migrates support-library-dependent libraries to\ninstead rely on the equivalent AndroidX packages. The tool lets you migrate an\nindividual library directly instead of using the Android Gradle plugin bundled\nwith Android Studio.\n| **Note:** Before you begin the migration, update your library to use version 28.0.0 of the Support Library.\n\nInstall Jetifier\n----------------\n\nTo install Jetifier, [download the zip\nfile](https://dl.google.com/dl/android/studio/jetifier-zips/1.0.0-beta10/jetifier-standalone.zip)\nand extract it. Your device must have Java version 1.8 or higher installed.\n\nUsage\n-----\n\nTo process a library, pass the path to the current library and the path to the\noutput file that the tool should create. Jetifier supports JAR, AAR, and ZIP\nfiles, including nested archives. \n\n```\n./jetifier-standalone -i \u003csource-library\u003e -o \u003coutput-library\u003e\n```\n\n### Options\n\nThe following table lists the available options for the Jetifier tool commands:\n\n| Option | Required? | Description |\n|----------------------------------------------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-i`, `--input` \u003cvar translate=\"no\"\u003e<path>\u003c/var\u003e | yes | Path to input library (JAR, AAR, or ZIP). |\n| `-o`, `--output` \u003cvar translate=\"no\"\u003e<path>\u003c/var\u003e | yes | Path to the output file. If the file already exists, Jetifier overwrites it. |\n| `-c`, `--config` \u003cvar translate=\"no\"\u003e<path>\u003c/var\u003e | no | Path to optional custom config file. |\n| `-l`, `--log` \u003cvar translate=\"no\"\u003e<level>\u003c/var\u003e | no | Logging level. Allowed values are: - error - warning - info - verbose If not specified, defaults to \"warning\". |\n| `-r` | no | Operate in reverse mode (\"de-jetification\"). |\n| `-rebuildTopOfTree`, `--rebuildTopOfTree` | no | Rebuild the ZIP of Maven distribution according to the generated POM file. If set, all rewritten libraries are assumed to be part of Support Library. Not needed for jetification. |\n| `-s`, `--strict` | no | Don't fallback when rules are missing; throw errors instead. |\n| `-stripSignatures`, `--stripSignatures` | no | Don't throw an error when jetifying a signed library; strip the signature files instead. |\n| `-t`, `-timestamp` \u003cvar translate=\"no\"\u003e<arg>\u003c/var\u003e | no | Timestamps policy to use for the archived entries as their modified time. Values: keepPrevious (default) epoch or now. |\n\n#### Example\n\nThe following example runs the utility on the library `libraryToProcess.aar` in\nthe current directory and writes the output to `result.aar` in the same\ndirectory: \n\n```\n./jetifier-standalone -i libraryToProcess.aar -o result.aar\n```\n\n### Usage notes\n\nJetifier migrates Java, XML, POM, and ProGuard references that point to\n`android.support.*` packages, changing them so they point to the corresponding\n`androidx.*` packages.\n\nSince ProGuard wildcards for `android.support.*` don't always map directly to\n`androidx.*` packages, Jetifier produces all eligible substitutions.\n\nIf there is a type in an `android.support.*` package that does not come from any\nSupport Library artifact, Jetifier still migrates the type as long as there is a\nmapping for it. However, this migration is not guaranteed to work, as there\nmight not be mapping rules general enough to cover all the custom types.\n\nAdvanced usage\n--------------\n\nThe Jetifier utility supports some advanced use cases.\n\n### Reverse mode\n\nIf you pass the `-r` flag, the utility runs in *reverse mode*. In this mode, the\nutility converts AndroidX APIs to the Support Library equivalents. Reverse mode\nis useful if you are developing\nlibraries that use AndroidX APIs but also need to distribute versions that use\nthe Support Library.\n\n#### Example\n\nThe following example runs the utility in reverse mode on the library\n`myAndroidXLib.aar` in the current directory and writes the output to\n`supportLibVersion.aar` in the same directory: \n\n```\n./jetifier-standalone -r -i myAndroidXLib.aar -o supportLibVersion.aar\n```\n\n### Custom config file\n\nThe Jetifier tool uses a config file to map Support Library classes to their\nAndroidX equivalents. If necessary, you can make a custom config file that\nalters this mapping. You can even add new classes to the mapping that are not\nactually members of the Support Library. For example, you might modify the\nmapping to replace one of your own classes with a successor class written to use\nAndroidX.\n\nTo use a custom config file:\n\n1. Extract the file `default.generated.config` from the utility's `jetifier-core-*.jar` file and save it.\n2. Make any necessary edits to your copy of the config file.\n3. Pass your file to the utility with the `-c` flag.\n\nFor example: \n\n```\n./jetifier-standalone -i libraryToProcess.aar -o result.aar -c myCustomMapping.config\n```"]]