با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مدل های زبان بزرگ (LLM) در قابلیت های خود متفاوت هستند. برای اینکه در توسعه نرمافزار به کمک هوش مصنوعی کنترل و انعطافپذیری داشته باشید، Android Studio به شما امکان میدهد LLM را انتخاب کنید که عملکرد هوش مصنوعی IDE را تقویت میکند. LLM باید محلی باشد و روی دستگاه شخصی شما اجرا شود.
پشتیبانی محلی LLM در نسخه Feature Drop Android Studio Narwhal 4 موجود است که می توانید آن را از کانال قناری دانلود کنید .
LLM را انتخاب کنید
یک LLM محلی جایگزینی برای پشتیبانی LLM ساخته شده در Android Studio ارائه می دهد. با این حال، Gemini در Android Studio به دلیل مدل های قدرتمند Gemini، معمولا بهترین تجربه هوش مصنوعی را برای توسعه دهندگان اندروید فراهم می کند. میتوانید از بین انواع مدلهای Gemini برای کارهای توسعه Android خود، از جمله مدل پیشفرض بدون هزینه یا مدلهایی که با کلید Gemini API پولی به آنها دسترسی دارید، انتخاب کنید.
اگر نیاز به کار آفلاین دارید، باید از سیاست های سختگیرانه شرکت در مورد استفاده از ابزار هوش مصنوعی پیروی کنید یا علاقه مند به آزمایش مدل های تحقیق منبع باز هستید، قابلیت LLM محلی یک گزینه عالی است.
پشتیبانی محلی LLM را تنظیم کنید
Android Studio Narwhal 4 Feature Drop Canary 2 یا بالاتر را دانلود و نصب کنید.
یک ارائه دهنده LLM مانند LM Studio یا Olama را روی رایانه محلی خود نصب کنید.
ارائه دهنده مدل را به Android Studio اضافه کنید.
به Settings > Tools > Gemini > Model Providers بروید
ارائه دهنده مدل را پیکربندی کنید:
نماد add انتخاب کنید
توضیحات ارائه دهنده مدل را وارد کنید (معمولاً نام ارائه دهنده مدل)
پورتی را که ارائه دهنده به آن گوش می دهد تنظیم کنید
یک مدل را فعال کنید
شکل 1. تنظیمات ارائه دهنده مدل.
مدل دلخواه خود را دانلود و نصب کنید.
کاتالوگ مدل LM Studio و Olama را ببینید. برای بهترین تجربه با Agent Mode در اندروید استودیو، مدلی را انتخاب کنید که برای استفاده از ابزار آموزش دیده است.
محیط استنتاج خود را شروع کنید.
محیط استنتاج LLM شما را به برنامه های محلی ارائه می کند. یک پنجره نشانه با طول زمینه به اندازه کافی بزرگ برای عملکرد بهینه پیکربندی کنید. برای دستورالعمل های دقیق در مورد راه اندازی و پیکربندی محیط خود، به مستندات Ollama یا LM Studio مراجعه کنید.
یک مدل انتخاب کنید.
اندروید استودیو را باز کنید. به پنجره چت Gemini بروید. از انتخابگر مدل برای جابجایی از مدل پیشفرض Gemini به مدل محلی پیکربندیشده خود استفاده کنید.
شکل 2. انتخابگر مدل.
پس از اتصال Android Studio به مدل محلی خود، می توانید از ویژگی های چت در IDE استفاده کنید. تمام فعل و انفعالات به طور کامل توسط مدلی که بر روی دستگاه محلی شما اجرا می شود، ایجاد می شود و یک محیط توسعه هوش مصنوعی مستقل به شما می دهد.
محدودیت های عملکرد را در نظر بگیرید
یک مدل محلی و آفلاین معمولاً به اندازه مدلهای Gemini مبتنی بر ابر کارآمد یا هوشمند نخواهد بود. پاسخهای چت از مدلهای محلی معمولاً دقت کمتری دارند و در مقایسه با مدلهای مبتنی بر ابر، تأخیر بیشتری دارند.
مدلهای محلی معمولاً برای توسعه اندروید بهخوبی تنظیم نمیشوند و مدلهای محلی میتوانند پاسخهایی را برگردانند که درباره رابط کاربری Android Studio اطلاعاتی ندارند. برخی از ویژگیهای اندروید استودیو هوش مصنوعی و موارد استفاده توسعه اندروید با یک مدل محلی غیر کاربردی هستند. با این حال، ویژگی چت هوش مصنوعی در اندروید استودیو به طور کلی توسط مدل های محلی پشتیبانی می شود.
برای پاسخدهی سریع و دقیق به همه جنبههای توسعه Android و پشتیبانی از همه ویژگیهای Android Studio، Gemini در Android Studio ، با مدلهای Gemini ، بهترین راهحل شماست.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Use a local LLM\n\n| **Preview:** Support for local LLMs is in [preview](/studio/preview).\n\nLarge language models (LLMs) differ in their capabilities. To give you control\nand flexibility in AI-assisted software development, Android Studio lets you\nchoose the LLM that powers the IDE's AI functionality. The LLM must be local,\nrunning on your personal machine.\n\nLocal LLM support is available in the Android Studio Narwhal 4 Feature Drop\nrelease, which you can [download from the canary channel](/studio/preview).\n| **Warning:** By using a third-party model, you agree to send your code and other input data to the provider of the model. Review the model provider's terms to understand how your data will be used. Note that some Android Studio features might not function as expected with external models.\n\nChoose an LLM\n-------------\n\nA local LLM offers an alternative to the LLM support built into Android Studio;\nhowever, [Gemini in Android Studio](/gemini-in-android) typically provides the best AI experience\nfor Android developers because of the powerful [Gemini models](https://deepmind.google/models/gemini/). You can select\nfrom a variety of Gemini models for your Android development tasks, including\nthe no-cost default model or models accessed with a paid [Gemini API key](/studio/gemini/add-api-key).\n\nLocal LLM capability is a great option if you need to work offline, must adhere\nto strict company policies on AI tool usage, or are interested in experimenting\nwith open-source research models.\n\nSet up local LLM support\n------------------------\n\n1. Download and install Android Studio Narwhal 4 Feature Drop Canary 2 or\n higher.\n\n2. Install an LLM provider such as [LM Studio](https://lmstudio.ai) or\n [Ollama](https://ollama.com) on your local computer.\n\n3. Add the model provider to Android Studio.\n\n - Go to **Settings \\\u003e Tools \\\u003e Gemini \\\u003e Model Providers**\n\n - Configure the model provider:\n\n - Select the add icon\n - Enter a description of the model provider (typically the model provider's name)\n - Set the port on which the provider is listening\n - Enable a model\n\n **Figure 1.** Model provider settings.\n4. Download and install a model of your choice.\n\n See the [LM Studio](https://lmstudio.ai/models) and [Ollama](https://ollama.com/search) model\n catalogs. For the best experience with Agent Mode in Android Studio, select\n a model that has been trained for tool use.\n5. Start your inference environment.\n\n The inference environment serves your LLM to local applications. Configure a\n sufficiently large context length token window for optimal performance. For\n detailed instructions on starting and configuring your environment, see the\n [Ollama](https://github.com/ollama/ollama/blob/main/README.md#quickstart) or\n [LM Studio](https://lmstudio.ai/docs/app/basics) documentation.\n6. Select a model.\n\n Open Android Studio. Navigate to the Gemini chat window. Use the model\n picker to switch from the default Gemini model to your configured local\n model.\n **Figure 2.** Model picker.\n\nAfter you've connected Android Studio to your local model, you can use the chat\nfeatures within the IDE. All interactions are powered entirely by the model\nrunning on your local machine, giving you a self-contained AI development\nenvironment.\n\nConsider performance limitations\n--------------------------------\n\nA local, offline model typically won't be as performant or intelligent as the\ncloud-based Gemini models. Chat responses from local models are usually less\naccurate and have higher latency compared to cloud-based models.\n\nLocal models are usually not fine-tuned for Android development, and local\nmodels can return responses that are uninformed about the Android Studio user\ninterface. Some Android Studio AI features and Android development use cases are\nnonfunctional with a local model. However, the AI chat feature in Android Studio\nis generally supported by local models.\n\nFor fast, accurate responses on all aspects of Android development and support\nfor all Android Studio features, [Gemini in Android Studio](/gemini-in-android), powered by the\n[Gemini models](https://deepmind.google/models/gemini/), is your best solution.\n\nTry it and provide feedback\n---------------------------\n\nYou can explore local LLM support by downloading the [latest preview version of\nAndroid Studio](/studio/preview) from the canary release channel.\n\n[Check known issues](/studio/known-issues) to see if any problems you encounter are already\ndocumented. If you find new issues, [report bugs](/studio/report-bugs)."]]