数据和隐私
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android Studio 中的 Gemini 在设计上充分考虑了对用户隐私的保护。
我们深知,确保代码的隐私性对于赢得和维护开发者的信任至关重要。Android Studio 中的 Gemini 经过精心设计,未经您的同意,您的代码绝不会离开您的计算机。如果您选择提供代码上下文,Gemini 会使用该额外上下文来更好地回答您的问题。您可以完全控制要共享哪些数据。
在 Google,我们认为信任源自透明。本页概述了我们的 AI 承诺、训练理念和技术控制措施,以管理您的数据的使用方式。
我们的保证
Gemini 在构建时秉承了 Google 的 AI 原则。这些原则阐明了我们以负责任的方式开发 AI 技术的承诺。
此外,当您在 Android Studio 中使用 Gemini 时,Google 会按照我们的隐私权政策和 Gemini 隐私权声明处理您的数据。如果您订阅 Gemini Code Assist,在企业环境中使用 Android Studio 中的 Gemini,Google 会根据 Google Cloud 隐私权声明处理您的数据。
数据收集和使用
未经您的明确同意,我们不会与 Gemini 分享您的代码。您可以选择与 Gemini 分享代码,以启用上下文感知功能,从而让 Gemini 能够提供特定于项目的回答。
以下是您的数据可能被收集和使用的方式:
- 您的反馈数据(例如“我喜欢”和“不喜欢”信号)可能会用于训练 Gemini。
- 如果您在 Android Studio 中使用面向个人的 Gemini,您在对话体验中明确输入的代码可能会用于训练 Gemini。如果您选择启用情境感知功能,我们可能会使用收集的信息(包括代码)来改进我们的产品和服务,例如机器学习技术。如需了解详情,请参阅我们的隐私权声明。
- 如果您在企业环境中使用 Gemini in Android Studio,那么您在对话体验中输入的代码绝不会用于训练 Gemini。如果您选择启用情境感知功能,我们绝不会使用收集的信息(包括代码)来改进我们的产品和服务,例如机器学习技术。如需了解详情,请参阅《Google Cloud 隐私权声明》。
如果您选择使用 AI 代码补全功能,我们会使用代码库中的上下文来提供更高质量的回答。
您可以在停用情境感知功能的情况下使用 Gemini,但这样做的代价是功能准确性降低,并且某些功能(例如由机器学习技术支持的代码补全)会被停用。Android Studio 提供内置的隐私权控制功能,可让您调整要启用的情境感知级别,方法是依次点击 File(在 macOS 上,点击 Android Studio)> Settings > Tools > Gemini。如需阻止代码库的某些部分共享上下文,请参阅使用 .aiexclude 文件配置上下文共享。
我们会以 Google 无法识别数据提供者身份的方式存储数据,并且无法根据要求删除数据。这些数据最多会保留 18 个月。
如需了解详情,请参阅 Gemini 隐私权声明。
提交和接收的数据
以下是提交给 Gemini 和从 Gemini 收到的不同类型的数据:
- 使用情况统计信息:指定您如何使用 Android Studio 及其相关工具的数据,例如您如何使用功能以及资源使用情况。这包括 Studio 内部的软件标识符,例如软件包名称、类名称和插件配置。您可以依次选择 File(在 macOS 上,选择 Android Studio)> Settings > Appearance & Behavior > Data Sharing,来启用或停用此共享功能。
- 提示和回答:您向 Gemini 提出的问题(包括您提交给 Gemini 以进行分析或完成的任何输入信息或代码)称为“提示”。您从 Gemini 收到的答案或代码补全结果称为“回答”。
- 反馈信号:赞成票和反对票以及您提供的任何其他反馈。
- 上下文(可选):Gemini 可能会发送代码库中的其他信息,例如部分代码、文件类型以及为大语言模型 (LLM) 提供上下文可能需要的任何其他信息。这有助于 Gemini 提供更高质量的相关回答。这样一来,Gemini 还可以提供其他实验性功能,例如 AI 代码补全。
开发者选择
默认情况下,Gemini 无法查看编辑器窗口中的代码,只会使用聊天机器人中的提示和对话记录来生成回答。不过,您可以选择分享代码库中的上下文,以便获得更高质量的回答并使用 AI 代码补全等实验性功能。
有三种机制可用于控制项目源代码的共享,以便为 Gemini 提供上下文:

全局设置
Studio 在 File(在 macOS 上为 Android Studio)> Settings > Tools > Gemini 下提供了一个全局选择启用偏好设置,用于指定是否可以将源代码发送到 Gemini 服务器,以便提供情境感知功能。

为每个项目选择不同的选项
如果在 Studio 的 Gemini 设置中选择了“根据每个项目决定是否启用”,则首次打开每个项目时,系统会显示一个对话框,询问是否应为该项目启用上下文感知功能。此设置保存在项目的 .idea
目录中。

源代码级限制
在项目的源代码目录中添加 .aiexclude
文件,可以更精细地控制哪些文件可作为 AI 模型的上下文使用。
详细了解 .aiexclude 格式。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-31。
[null,null,["最后更新时间 (UTC):2025-07-31。"],[],[],null,["# Data and privacy\n\n**Gemini in Android Studio is built with your privacy in mind.**\n\nWe know that ensuring the privacy of your code is critical to earning and\nmaintaining the trust of our developers. Gemini in Android Studio is designed\nso that your code never leaves your computer without your consent. If you choose\nto provide code context, Gemini uses that additional context to better\nanswer your questions. You have full control over what data is shared.\n\nAt Google, we believe that trust comes from transparency. This page outlines our\nAI commitments, training philosophy, and technical controls to manage how your\ndata is used.\n\u003e **Our assurances**\n\u003e\n\u003e Gemini is built with Google's\n\u003e [AI Principles](https://ai.google/responsibility/principles/)\n\u003e in mind. These principles describe our commitment to developing AI technology\n\u003e responsibly.\n\u003e\n\u003e Additionally, when you use Gemini in Android Studio, Google handles your\n\u003e data in accordance with our\n\u003e [Privacy Policy](https://policies.google.com/privacy) and the [Gemini\n\u003e Privacy Notice](/studio/gemini/privacy-notice). When you use Gemini in\n\u003e Android Studio for businesses by subscribing to Gemini Code Assist, Google\n\u003e handles your data in accordance with the\n\u003e [Google Cloud Privacy Notice](https://cloud.google.com/terms/cloud-privacy-notice).\n\nData collection and use\n-----------------------\n\nYour code isn't shared with Gemini without your explicit consent. You have the\noption to share your code with Gemini in order to enable context awareness\nfeatures, providing Gemini with the ability to offer project-specific\nresponses.\n\nHere's how your data may be collected and used:\n\n- Your feedback data, such as thumbs up and thumbs down signals, may be used to train Gemini.\n- If you're using Gemini in Android Studio for individuals, the code you explicitly enter into the chat experience may be used to train Gemini. If you opt in to context awareness, the information collected---including code---may be used to improve our products and services, such as machine learning technologies. See our [privacy notice](/studio/gemini/privacy-notice) for more details.\n- If you're using Gemini in Android Studio for businesses, the code you enter into the chat experience is never used to train Gemini. If you opt in to context awareness, the information collected---including code---is never used to improve our products and services, such as machine learning technologies. See the [Google Cloud Privacy Notice](https://cloud.google.com/terms/cloud-privacy-notice) for more details.\n\nIf you opt in to use the AI code completion feature, we use context from your\ncodebase to provide higher quality responses.\n\nYou can use Gemini with context awareness features disabled, with the trade-off\nof less accurate features, and some features disabled such as ML powered code\ncompletion. Android Studio provides built-in privacy controls to adjust the\nlevel of context awareness you want to enable, using **File**\n(**Android Studio** on macOS) \\\u003e **Settings \\\u003e Tools \\\u003e Gemini** . To block context\nsharing for certain portions of your codebase, see [Configure context sharing\nwith .aiexclude files](/studio/gemini/aiexclude).\n\nThe data is stored in a way where Google can't tell who provided it, and it's\nnot possible to delete upon request. The data is retained for up to 18 months.\nFor more information, see the [Gemini Privacy\nNotice](/studio/gemini/privacy-notice).\n\nData submitted and received\n---------------------------\n\nHere are the different types of data submitted to and received from Gemini:\n\n- **Usage statistics:** Data specifying how you use Android Studio and its related tools, such as how you use features and resource usage. This includes software identifiers internal to Studio such as package names, class names, and plugin configuration. You can enable or disable this sharing from **File** (**Android Studio** on macOS) \\\u003e **Settings** \\\u003e **Appearance \\& Behavior** \\\u003e **Data Sharing**.\n- **Prompts and responses:** The questions that you ask Gemini, including any input information or code that you submit to Gemini to analyze or complete, are called prompts. The answers or code completions that you receive from Gemini are called responses.\n- **Feedback signals:** Thumbs up and down votes and any other feedback that you provide.\n- **Context (optional):** Gemini might send additional information from your codebase such as pieces of your code, file types, and any other information that might be necessary to provide context to the Large language Model (LLM). This helps Gemini provide higher quality and relevant responses. This also lets Gemini provide additional experimental capabilities such as AI code completion.\n\nDeveloper choice\n----------------\n\nBy default, Gemini can't see the code in the editor window and only uses the\nprompts and conversation history in the chatbot to respond. However, you can opt\nin to sharing context from your codebase to enable higher quality responses and\naccess to experimental features such as AI code completion.\n\nThere are three mechanisms used to control sharing your project's source code\nfor the purposes of providing context to Gemini:\n\n**Global settings**\n\nStudio's provides a global opt in preference under\n**File** (**Android Studio** on macOS) \\\u003e **Settings \\\u003e Tools \\\u003e Gemini**,\nspecifying whether source code may sent to Gemini servers in order to provide\ncontext awareness.\n\n\u003cbr /\u003e\n\n**Choose different options for each project**\n\nIf \"Ask to decide per project\" is selected in Studio's Gemini settings, a dialog\nis displayed the first time each project is opened asking whether context\nawareness should be enabled for that project. This setting is saved in the\nproject's `.idea` directory.\n\n\u003cbr /\u003e\n\n**Source-code level restrictions**\n\nAdding an `.aiexclude` file into your project's source code directory provides\nmore granular control over which files are eligible to be used as context for AI\nmodels.\n\n[Learn more about the .aiexclude\nformat.](/studio/gemini/aiexclude)\n\n\u003cbr /\u003e"]]