קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במכשירים שמותקנת בהם גרסת Android 10 (API ברמה 29) ומעלה, אפשר להגדיר לפלטפורמה להפעיל קוד DEX מוטמע ישירות מקובץ ה-APK של האפליקציה. האפשרות הזו יכולה לעזור למנוע מתקפה אם תוקף הצליח לשנות את הקוד שקומפל באופן מקומי במכשיר.
אם אתם משתמשים במערכת Gradle לבנייה, כדי להפעיל את התכונה הזו צריך לבצע את הפעולות הבאות:
מגדירים את המאפיין android::useEmbeddedDex לערך
true ברכיב
<application>
של קובץ המניפסט של האפליקציה.
מגדירים את useLegacyPackaging ל-false בקובץ build.gradle.kts ברמת המודול (קובץ build.gradle אם משתמשים ב-Groovy).
Kotlin
packagingOptions{dex{useLegacyPackaging=false}}
גרוב
packagingOptions{dex{useLegacyPackagingfalse}}
אם אתם משתמשים במערכת הבנייה של Bazel, כדי להפעיל את התכונה הזו צריך להגדיר את המאפיין android:useEmbeddedDex לערך true באלמנט <application> של קובץ המניפסט של האפליקציה, ולהשאיר את קובצי ה-DEX לא דחוסים:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-27 (שעון UTC)."],[],[],null,["On devices running Android 10 (API level 29) and higher you can tell the platform to run\nembedded DEX code directly from your app's APK file. This option can help\nprevent an attack if an attacker ever managed to tamper with the locally\ncompiled code on the device.\n| **Note:** Enabling this feature could possibly affect your app's performance because ART must use the [JIT compiler](https://source.android.com/devices/tech/dalvik/jit-compiler) when the app is started (instead of reading native code that was compiled ahead of time). We recommend testing your app's performance before you decide whether or not to enable this feature in your published apps.\n\nIf you're using the Gradle build system, to enable this feature do the\nfollowing:\n\n- Set the `android::useEmbeddedDex` attribute to\n `true` in the\n [\u003capplication\u003e](/guide/topics/manifest/application-element)\n element of your app's manifest file.\n\n- Set `useLegacyPackaging` to `false` in the\n module-level `build.gradle.kts` file (`build.gradle`\n file if you're using Groovy).\n\n **Note:** Don't set the `useLegacyPackaging` option if you're using a version of AGP lower than 4.2. \n\n Kotlin \n\n ```kotlin\n packagingOptions {\n dex {\n useLegacyPackaging = false\n }\n }\n \n ```\n\n Groovy \n\n ```groovy\n packagingOptions {\n dex {\n useLegacyPackaging false\n }\n }\n \n ```\n\nIf you're using the Bazel build system, to enable this feature set the\n`android:useEmbeddedDex` attribute to `true` in the `\u003capplication\u003e` element of\nyour app's manifest file and leave DEX files uncompressed: \n\n```\nandroid_binary(\n ...\n nocompress_extensions = [\".dex\"],\n)\n```\n\nRecommended for you\n\n- Note: link text is displayed when JavaScript is off\n- [Tapjacking](/topic/security/risks/tapjacking)\n- [android:exported](/topic/security/risks/android-exported)\n- [# Key management {:#key-management}](/topic/security/data)"]]