在 Android Studio 中開發遊戲
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以透過 C/C++ 使用 Android Studio,讓遊戲在 Android 平台上上線。
Android Studio 是 Android 應用程式的官方整合開發環境 (IDE),專供開發 Android 應用程式使用。其針對使用 Android Native Development Kit (NDK) 的 C/C++ 程式設計語言和開發項目,提供廣泛的支援,適用於多種作業系統。
如果您已有 Microsoft Visual Studio 專案,並且主要在 Windows 上以 C 或 C++ 進行開發,則可使用 Android Game Development Extension 進行 Microsoft Visual Studio 的開發作業。
管理專案
Android Studio 整合了 CMake 支援功能,以便設定和管理 C/C++ 程式碼。CMake 可讓您以模組化方式建構 C/C++ 專案。Android Studio 的 Gradle 建構系統和 Android Gradle 外掛程式會使用 CMake 設定原生 C/C++ 程式碼模組的建構程序。
Android Studio 編輯器提供完善的 C/C++ 程式碼編輯和索引功能。這些編輯器的標準功能包括程式碼完成、語法重新格式化、符號查詢,以及預先編譯錯誤檢查。
整合依附元件
Android Studio 的 Gradle 建構系統支援為專案宣告本機或遠端二進位檔依附元件。常見的用途是從 Maven 遠端依附元件伺服器提取程式庫 (例如 Android Jetpack)。這些依附元件可精準控制應用程式中整合的依附元件版本。遠端依附元件也有助於避免將無關檔案提交至專案的版本管控系統。
在 Android Studio 中偵錯
Android Studio 提供偵錯工具,讓您在模擬器或實體裝置上為遊戲進行偵錯。Android Studio 偵錯工具支援 C/C++、Java 和 Kotlin,並使用 LLDB 對 C/C++ 進行偵錯。所有語言均提供程式中斷點和變數檢查。您可以在使用 LLDB 對 C/C++ 程式碼進行偵錯時,設定硬體觀察點。Android Studio 偵錯工具支援定義自訂資料類型轉譯器,以強化顯示專案資料結構。
Android Studio 中的設定檔
Android Studio 提供了剖析工具,可協助您評估遊戲的執行階段效能。剖析類別包括 CPU 用量、記憶體用量、網路活動和能源用量。有效使用剖析工具可以減少遊戲中效能不彰或記憶體不足導致當機的情況,以免對玩家造成負面影響。減少遊戲的能源消耗可以避免因熱節流而導致效能問題。
Android Studio 具備應用程式套件分析工具,可讓您檢查建構作業中占用的空間。這些工具與 Play Asset Delivery 等功能搭配使用時,有助於提升遊戲大小,並確保使用者不會下載不必要的資料。
如要進一步瞭解 Android Studio,包括系統需求、下載連結以及使用手冊,請造訪 Android Studio 頁面。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Develop your game in Android Studio\n\nYou can use Android Studio with C/C++ to bring your game to life on Android.\n\n[Android Studio](/studio) is the official Integrated Development Environment\n(IDE) for Android app development. It includes extensive support for the C/C++\nprogramming language and development using the\n[Android Native Development Kit (NDK)](/ndk), and is available on multiple\noperating systems.\n\nIf you have existing Microsoft Visual Studio projects and develop primarily on\nWindows in C or C++, you can use the\n[Android Game Development Extension](/games/agde) for Microsoft Visual Studio\ninstead.\n\nManage your project\n-------------------\n\nAndroid Studio integrates CMake support for configuration and management of\nC/C++ code. CMake allows you to structure your C/C++ project in a modular\nfashion. Android Studio's Gradle build system and\n[Android Gradle plugin](/studio/releases/gradle-plugin)\nuse CMake to set up the build process for native C/C++ code modules.\n\nThe Android Studio editor has robust editing and indexing capabilities for C/C++\ncode. Standard features of the editor include code completion, syntax\nreformatting, symbol lookups, and pre-compile error checking.\n\nIntegrate dependencies\n----------------------\n\nAndroid Studio's Gradle build system supports declaring local or remote binary\ndependencies for your project. A common use case is pulling in libraries such as\n[Android Jetpack](/jetpack) from a Maven remote dependency server. These\ndependencies allow precise control of what version of a dependency is being\nintegrated into an app. Remote dependencies also help avoid committing\nextraneous files into your project's version control system.\n\nDebug in Android Studio\n-----------------------\n\nAndroid Studio provides a debugger that enables you to debug your game on either\nan emulator or a physical device. The Android Studio debugger supports C/C++,\nJava, and Kotlin, and uses [LLDB](https://lldb.llvm.org/) to debug\nC/C++. Program breakpoints and variable inspection are available for all\nlanguages. You can set hardware watchpoints when debugging C/C++ code using\nLLDB. The Android Studio debugger supports defining custom data type renderers\nfor enhanced display of project data structures.\n\nProfile in Android Studio\n-------------------------\n\nAndroid Studio includes profiling tools that help measure the runtime\nperformance of your game. Profiling categories include CPU usage, memory usage,\nnetwork activity and energy use. Effective use of profiling tools can reduce\nperformance hiccups or out of memory crashes in your game that negatively impact\nyour players. Reducing energy consumption of your game can avoid performance\nproblems due to thermal throttling.\n\nAndroid Studio features application package analysis tools that let you inspect\nwhat is taking up space in your build. These tools, when used in concert with\nfeatures such as Play Asset Delivery, help optimize the size of your game and\nensure your users don't download more data than is necessary.\n\nMore Information\n----------------\n\nFor more information on Android Studio, including system requirements, download\nlinks, and the user guide, visit the [Android Studio](/studio) page."]]