在 ChromeOS 设备上测试游戏
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了如何在支持 Android 的 ChromeOS 设备上运行游戏,以便进行测试。如果您无法访问开发者模拟器,则可以使用 ChromeOS 作为 Google Play 游戏电脑版的替代测试平台。
如果您可以访问开发者模拟器,我们建议您使用该模拟器来测试游戏,因为它是最接近 Google Play 游戏电脑版的环境。
加载并运行游戏
您可以使用 Android 调试桥 (adb) 将 APK 文件加载到 ChromeOS 设备。我们建议您安装以下任一内含最新版 adb 的工具(如果您尚未安装的话):
您还需要在 ChromeOS 设备上启用 adb 连接。
您可以直接在 Android Studio 中运行应用,也可以使用 adb install
命令将 APK 文件部署到 ChromeOS 设备。如果您的游戏使用 Android App Bundle 文件,请使用 bundletool install-apks
来部署文件。
adb install C:\yourpath\yourgame.apk
如果您需要根据设备类型切换游戏功能,请通过查找 "org.chromium.arc"
系统功能来检测 ChromeOS 设备:
Kotlin
var isPC = packageManager.hasSystemFeature("org.chromium.arc")
Java
PackageManager pm = getPackageManager();
boolean isPC = pm.hasSystemFeature("org.chromium.arc")
C#
var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
var currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
var packageManager = currentActivity.Call<AndroidJavaObject>("getPackageManager");
var isPC = packageManager.Call<bool>("hasSystemFeature", "org.chromium.arc");
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Test your game on ChromeOS devices\n\nThis page describes how to run your game on a\n[ChromeOS device that supports Android](https://www.chromium.org/chromium-os/chrome-os-systems-supporting-android-apps/)\nfor testing purposes. You can use ChromeOS as an alternate testing plarform for\nGoogle Play Games on PC if you don't have access to the\n[developer emulator](/games/playgames/emulator).\n\nIf you have access to the\n[developer emulator](/games/playgames/emulator), we recommend you use it to\ntest your game because it is the closest environment to\nGoogle Play Games on PC.\n\nLoad and run your game\n----------------------\n\nYou can use [Android Debug Bridge (adb)](/studio/command-line/adb) to load\nAPK files to your ChromeOS devices. If you haven't already done so,\nwe recommend that you install one of the following\ntools, which include the latest version of adb:\n\n- [Android Studio](/studio)\n\n- [Android SDK Platform tools](/studio/releases/platform-tools#downloads)\n\nYou also need to [enable ADB connection on your ChromeOS devices](https://support.google.com/chromebook/answer/9770692?ref_topic=3415446).\n\nYou can run your app directly from Android Studio, or use the `adb install`\ncommand to deploy your APK file to ChromeOS devices. If your game uses an\nAndroid App Bundle, use [`bundletool install-apks`](/studio/command-line/bundletool#deploy_with_bundletool) to deploy the files. \n\n adb install C:\\yourpath\\yourgame.apk\n\nDetect the platform\n-------------------\n\nIf you need to toggle gameplay features based on device type, look for the\n`\"org.chromium.arc\"` system feature to detect ChromeOS devices: \n\n### Kotlin\n\n```kotlin\nvar isPC = packageManager.hasSystemFeature(\"org.chromium.arc\")\n \n```\n\n### Java\n\n```java\nPackageManager pm = getPackageManager();\nboolean isPC = pm.hasSystemFeature(\"org.chromium.arc\")\n \n```\n\n### C#\n\n```c#\nvar unityPlayerClass = new AndroidJavaClass(\"com.unity3d.player.UnityPlayer\");\nvar currentActivity = unityPlayerClass.GetStatic\u003cAndroidJavaObject\u003e(\"currentActivity\");\nvar packageManager = currentActivity.Call\u003cAndroidJavaObject\u003e(\"getPackageManager\");\nvar isPC = packageManager.Call\u003cbool\u003e(\"hasSystemFeature\", \"org.chromium.arc\");\n \n```"]]