自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
Cuttlefish 虚拟 Android 设备
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Cuttlefish 是一种可配置的虚拟 Android 设备,既可以远程运行(使用第三方云产品,如 Google Cloud Engine),也可以在本地运行(在 Linux x86 和 ARM64 机器上)。
Cuttlefish 的目标
Cuttlefish 与其他设备的对比情况
Cuttlefish 和 Android 模拟器
Cuttlefish 与 Android 模拟器有许多相似之处,但 Cuttlefish 可以保证 Android 框架(无论这是纯 AOSP,还是您自己的树中的自定义实现)实现全保真。在实际应用中,这意味着 Cuttlefish 应该会在操作系统级别响应您的互动,就像使用相同的自定义或纯 Android OS 源代码构建的实体手机目标一样。
Android 模拟器围绕简化应用开发的用例构建而成,它包含许多功能钩子来迎合 Android 应用开发者的用例。如果您要使用您的自定义 Android 框架来构建模拟器,这可能会带来一些挑战。如果您需要能够代表您的自定义平台/框架代码或 Android 树形结构的虚拟设备,那么 Cuttlefish 虚拟设备是理想的选择。它是用于表示当前 AOSP 开发状态的规范设备。
Cuttlefish 和物理设备
Cuttlefish 虚拟设备与实体设备之间的主要区别在于硬件抽象层 (HAL) 级别,以及与任何自定义硬件互动的任何软件。除了硬件专用实现之外,您应该会发现 Cuttlefish 和实体设备表现出在功能上等效的行为。
Cuttlefish 有哪些益处?
您可以像与任何可能用于调试的其他 Android 设备互动一样与 Cuttlefish 互动。它会通过 adb 将自身注册为正常设备,您可以像与实体设备互动一样通过远程桌面与之互动。Cuttlefish 的用例非常广泛,涵盖应用测试、自定义系统构建测试等。
由于 Cuttlefish 力求实现框架保真度,因此可用于对您的框架或应用进行功能测试,在测试中没有无法模拟的物理硬件依赖项。
目前 Cuttlefish 通常如何用于测试?
Cuttlefish 在测试方面的一些常见应用包括:
我是否可以在云端托管 Cuttlefish?
可以,Cuttlefish 本身支持 Google Cloud,并计划支持其他云平台。
开始使用
如需获得有关基于 AOSP 创建 Cuttlefish 实例的指导,请参阅使用 Cuttlefish。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","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"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Cuttlefish virtual Android devices\n\n*Cuttlefish* is a configurable virtual Android device that can run both remotely\n(using third-party cloud offerings such as Google Cloud Engine) and locally (on\nLinux x86 and ARM64 machines).\n\nCuttlefish goals\n----------------\n\n- Free the platform and app developer from being dependent on physical hardware to develop and validate code changes.\n- Replicate the framework-based behavior of a real device with a focus on **high fidelity** by maintaining close alignment with the core framework.\n- Support all API levels after 28.\n- Provide a **consistent** level of functionality across API levels, aligned with the behavior on physical hardware.\n- Enable scale:\n\n - Provide the ability to run multiple devices in parallel.\n - Enable concurrent test execution with high fidelity at a lower cost of entry.\n- Provide a configurable device with the ability to adjust form factor, RAM,\n CPUs, etc.\n\nCompare Cuttlefish to other devices\n-----------------------------------\n\n### Cuttlefish and Android Emulator\n\nThere are many similarities with the [Android Emulator](/docs/setup/test/avd),\nbut Cuttlefish guarantees full fidelity with Android framework (whether this is\npure AOSP or a custom implementation in your own tree). In real-world\napplication, this means that you should expect Cuttlefish to respond to your\ninteractions at the OS level just like a physical phone target built with the\nsame customized or pure Android OS source.\n\nThe Android Emulator has been built around the use case of making app\ndevelopment easy, and it contains many functional hooks to appeal to the use\ncases of the Android app developer. This may present challenges if you want\nto build an emulator with your customized Android framework. If you need a\nvirtual device that will be representative of your custom platform/framework\ncode or tip-of-tree Android, then Cuttlefish is an ideal virtual option. It is\nthe canonical device for representing the current state of AOSP development.\n\n### Cuttlefish and physical device\n\nThe primary differences between a Cuttlefish virtual device and your physical\ndevice are at the hardware abstraction layer (HAL) level, as well as any\nsoftware that interacts with any custom hardware. Except for hardware-specific\nimplementations, you should expect functionally equivalent behavior between\nCuttlefish and a physical device.\n\nHow can Cuttlefish help?\n------------------------\n\nYou can interact with Cuttlefish just like you would with any other Android\ndevice that you might use for debugging. It will register itself as a normal\ndevice via adb and you can interact with it like a physical device via remote\ndesktop. The use cases are broad and can span app testing, custom system\nbuild testing and more.\n\nBecause Cuttlefish strives for full framework fidelity, it can be used for\nfunctional testing of your framework or apps where there are no\nphysical hardware dependencies that are impossible to emulate.\n\n### How is Cuttlefish commonly used for testing today?\n\nSome common applications of Cuttlefish for testing include:\n\n- CTS\n- Framework compliance\n- Continuous integration testing\n- Custom test suites\n\nCan I host Cuttlefish in the cloud?\n-----------------------------------\n\nYes, Cuttlefish natively supports Google Cloud and support for other cloud\nplatforms is planned.\n\nGet started\n-----------\n\nFor guidance on creating a Cuttlefish instance based on AOSP, see\n[Use Cuttlefish](/docs/devices/cuttlefish/get-started)."]]