הגדרת שיתוף ההקשר עם קובצי .aiexcluded
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כשמפעילים את האפשרות לשתף את ההקשר של הפרויקט עם Gemini ב-Android Studio, אפשר לשלוט בקבצים הספציפיים מתוך בסיס הקוד שמשותפים באמצעות קובצי .aiexclude
. תכונות ה-AI ב-Android Studio לא יכולות לגשת לקבצים מחוץ לפרויקט הנוכחי ולשורשי בקרת הגרסאות שמצורפים אליו. לכן, אתם יכולים למקם קבצים של .aiexclude
בכל מקום בפרויקט ובשורשים של מערכת בקרת הגרסאות שלו כדי לקבוע לאילו קבצים תהיה גישה לתכונות ה-AI.
בדומה לקובץ .gitignore
, קובץ .aiexclude
עוקב אחרי קבצים שאסור לשתף עם Gemini ב-Android Studio, כולל חוויית הצ'אט וגם תכונות מבוססות-AI שפועלות בעורך, כמו השלמת קוד. קובץ
.aiexclude
פועל על קבצים בספרייה שמכילה אותו או בספריות שמתחתיה.

איך כותבים קובצי .aiexclude
קובץ .aiexclude
הוא בעל תחביר זהה לזה של קובץ .gitignore
.
דוגמאות
דוגמאות להגדרות של קובץ .aiexclude
:
- התבנית
KEYS
חוסמת את כל הקבצים שנקראים KEYS ללא סיומת קובץ בספרייה שמכילה את הקובץ .aiexclude
או בספריות שמתחתיה.
KEYS
- התבנית
KEYS.*
חוסמת את כל הקבצים שנקראים KEYS עם כל סיומת קובץ בתיקייה שמכילה את .קובץ aiexclude
.
KEYS.*
- התבנית
*.kt
חוסמת את כל קובצי Kotlin, או קבצים עם הסיומת .kt
, ברמה של התיקייה שמכילה את הקובץ .aiexclude
או ברמה שמתחתיה.
*.kt
- התבנית
/*.kt
חוסמת את כל הקבצים מסוג .kt
בספרייה .aiexclude
, אבל לא את הקבצים שמתחתיה.
/*.kt
- התבנית
my/sensitive/dir/
חוסמת את כל הקבצים בספרייה my/sensitive/dir
ובספריות המשנה שלה. נתיב הקובץ הוא יחסי לספרייה שמכילה את הקובץ .aiexclude
.
my/sensitive/dir/
- התבנית
my/sensitive/dir/**/.txt
חוסמת את כל הקבצים .txt
בספרייה my/sensitive/dir/
או בספריות שמתחתיה.
my/sensitive/dir/**/.txt
- התבנית
my/sensitive/dir/*.txt
חוסמת את כל הקבצים .txt
בספרייה my/sensitive/dir
, אבל לא בספריות משנה.
my/sensitive/dir/*.txt
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-31 (שעון 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-07-31 (שעון UTC)."],[],[],null,["# Configure context sharing with .aiexclude files\n\nWhen you opt in to sharing your project context with Gemini in Android Studio,\nyou can control which files specifically from the codebase are shared using\n`.aiexclude` files. AI features in Android Studio cannot access files outside of\nthe current project and the version control roots attached to it. With this in\nmind, you can place `.aiexclude` files anywhere within the project and its VCS\nroots to control which files AI features are allowed to access.\n\nMuch like a `.gitignore` file, an `.aiexclude` file tracks files that shouldn't\nbe shared with Gemini in Android Studio, including the chat experience as well\nas AI features that operate in the editor, like [code completion](/studio/gemini/code-completion). An\n`.aiexclude` file operates on files at or below the directory that contains it.\n\nHow to write `.aiexclude` files\n-------------------------------\n\nAn `.aiexclude` file follow the same syntax as a\n[`.gitignore` file](https://git-scm.com/docs/gitignore).\n\nExamples\n--------\n\nHere are example `.aiexclude` file configurations:\n\n- The pattern `KEYS` blocks all files called \"KEYS\" with no file extension at or below the directory that contains the `.aiexclude` file.\n\n KEYS\n\n- The pattern `KEYS.*` blocks all files called \"KEYS\" with any file extension at or below the directory that contains the .`aiexclude` file.\n\n KEYS.*\n\n- The pattern `*.kt` blocks all Kotlin files, or files with the extension `.kt`, at or below the directory that contains the `.aiexclude` file.\n\n *.kt\n\n- The pattern `/*.kt` blocks all `.kt` files in the `.aiexclude` directory, but not below.\n\n /*.kt\n\n- The pattern `my/sensitive/dir/` blocks all files in the `my/sensitive/dir` directory and below. The file path is relative to the directory that contains the `.aiexclude` file.\n\n my/sensitive/dir/\n\n- The pattern `my/sensitive/dir/**/.txt` blocks all `.txt` files at or below the directory `my/sensitive/dir/`.\n\n my/sensitive/dir/**/.txt\n\n- The pattern `my/sensitive/dir/*.txt` blocks all `.txt` files in the directory `my/sensitive/dir`, but not in sub-directories.\n\n my/sensitive/dir/*.txt"]]