如果您主要使用 Microsoft Visual Studio,则可以使用 Android Game Development Extension (AGDE) 将 Android 目标添加到现有项目中。AGDE 支持在 Visual Studio 中进行原生调试,并且包含许多 Android Studio 性能分析工具的独立版本。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# About customizing or porting game engines\n\nIf you're using C or C++ to develop or customize a game engine, the following\nrequirements are critical to integrating Android support into your game engine.\n\n- Take advantage of Android development tools\n- Construct an activity\n- Draw to the screen\n- Process input events\n- Output audio\n- Manage memory\n- Test and polish\n- Publish to Google Play\n\nThe requirements described on this page do not teach you how to develop a game\nengine from scratch, but rather identify the areas where Android is relatively\nunique compared to other platforms.\n| **Note:** If you're using Unity, Unreal, Defold or Godot, see [Game engines on\n| Android](/games/engines/engines-overview) for resources on developing for Android using one of these game engines.\n\nTake advantage of Android development tools\n-------------------------------------------\n\n[Android Studio](/games/develop/develop-as) includes tools you can use to:\n\n- Configure your project\n- Build, debug, and package your game\n- Examine the performance of your game using system, CPU, and memory profilers\n- Inspect the contents of your game's package or application bundle\n- Integrate additional features of the Android SDK and NDK\n\n[Android Graphics Inspector](/agi) can characterize the rendering performance\nof your game and help you investigate the details of rendered frames using frame\nprofiling.\n\nIf you're primarily using Microsoft Visual Studio, you can use\nthe [Android Game Development Extension](/games/agde) (AGDE) to add an Android\ntarget to existing projects. AGDE supports native debugging in Visual Studio and\nincludes standalone versions of many of the Android Studio profiling tools.\n\nConstruct an activity\n---------------------\n\nYour game needs to construct and interact with an\n[`Activity`](/reference/android/app/Activity). Learn about the\n[Activity Lifecycle](/guide/components/activities/activity-lifecycle)\non Android to understand when an Activity is created, started, resumed, paused,\nstopped, and destroyed.\n\nRead about the [`GameActivity`](/games/agdk/game-activity) library,\nwhich integrates and meets the `Activity`-related needs (game window,\nlifecycle, rendering, handling events) of native C or C++ game engines.\n\nDraw to the screen\n------------------\n\nYour game needs to draw objects and sprites on the screen. Learn about the\nAndroid [`SurfaceView`](/reference/android/view/SurfaceView) and how\nto [configure graphics](/games/agdk/configure-graphics) in your game engine.\n\nAndroid devices support different display refresh rates. Learn about\n[rendering in game loops](/games/develop/gameloops) to prevent frame drops and\nframe buffers glitches.\n\nRead about how to [achieve frame pacing](/games/sdk/frame-pacing) for smooth\nrendering in OpenGL and Vulkan.\n[Optimize your frame rate](/games/sdk/performance-tuner) with Performance Tuner.\n\nUse multisample anti-aliasing (MSAA) to improve the quality of your rendering.\nMSAA can be used with very little overhead. To learn more, see the blog post\n[Multisampled Anti-aliasing For Almost Free --- On Tile-Based Rendering Hardware](https://medium.com/androiddevelopers/multisampled-anti-aliasing-for-almost-free-on-tile-based-rendering-hardware-21794c479cb9).\n\nProcess input events\n--------------------\n\nA game engine receives input events from a variety of sources. For an\nimmersive gaming experience, learn to support different Android input sources:\n\n- [Touch](/games/agdk/add-touch-support)\n- [Software keyboard](/games/agdk/add-support-for-text-input)\n- [Game controllers](/games/sdk/game-controller)\n- [Mouse](/games/sdk/game-controller/mouse)\n- [Sensors](/guide/topics/sensors/sensors_overview)\n\nOutput audio\n------------\n\nYour game engine needs to output audio across different devices and Android\nversions. Learn about Oboe, our open-source C++ audio library to\n[incorporate high-performance audio](/games/sdk/oboe) in your game.\n\nUse Oboe to achieve the lowest latency, avoid specific audio bugs, and auto\nselect the best available native library (such as AAudio or OpenSL ES).\n\nManage memory\n-------------\n\nOn Android devices, the system tries to use as much system memory (RAM) as\npossible and performs various memory optimizations to free up space when needed.\nLearn to [manage memory usage](/games/optimize/memory-allocation) to avoid\nslowing down or exiting your game.\n\nTest and polish\n---------------\n\nAn Android app crashes whenever there's an unexpected exit caused by an\nunhandled exception or signal. Learn about how to\n[detect and diagnose crashes](/games/optimize/crash), read stack traces,\nmemory and networking exceptions, how to use logcat, and how to understand\nJava and Kotlin-specific errors.\n\nPublish to Google Play\n----------------------\n\nPlayers download your game with various Android devices in different countries,\nnetwork conditions, and data plans. Learn how to use Google Play to\n[deliver app bundles and asset packs](/guide/playcore/asset-delivery)\nfor large games with the benefits of a content delivery network."]]