Glass Explorer Edition SDK 已弃用。本文档仍作为历史参考。
GDK 快速入门
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在开始使用 GDK 之前,您需要掌握中级知识或更好的 Android 开发知识。
本快速入门将引导您使用 GDK 设置您的环境,并向您展示如何安装您的第一个 Glassware。如需详细了解如何构建 Glassware,请查看模式指南。
面向 Android 专家
如果您熟悉 Android 设备,不妨先了解一下以下内容:
- 从 Android SDK 管理器获取 Android 4.4.2 (API 19) SDK 和 Glass Development Kit Preview 插件。
- 在 Glass 上,开启 USB 调试(依次点击设置 > 设备信息 > 开启调试)。
- 导入一些 GDK 示例。
- 如果您已准备好为自己的 Glassware 创建项目,请使用以下设置:
- 编译方式:Glass 开发套件开发者预览版
- Theme: None(即使您未指定主题,ADT 和 Android Studio 通常也会自动分配主题,因此请在创建项目后从清单中移除
android:theme
属性。)
- 如需了解详情,请参阅模式指南和开发者指南。

面向 Android 新手
我们建议您先学习 Android 开发者网站上的构建首个应用培训课程,然后再构建几个简单的 Android 应用,然后再构建 GDK Glassware。
设置开发环境
- 建议安装 Android Studio,以便更轻松地进行开发。其余步骤假定您已安装此产品。
- 依次点击 Configure > SDK Manager。
- 安装适用于 Android 4.4.2 (API 19) 的 SDK Platform 和 Glass Development Kit 预览版。其他所有内容都是可选的。
- 在 Glass 上,依次前往设置 > 设备信息 > 开启调试,以启用
adb
,以允许您的开发系统与 Glass 通信。
- 将 Glass 连接到开发系统,然后点按触控板以授予调试访问权限。
导入示例
为了帮助您快速上手,我们的 GitHub 代码库中提供了 GDK 示例项目:
- ApiDemo:展示一些 GDK API 用法的图库。
- 罗盘:使用
LiveCard
的简单罗盘。
- 秒表:使用
LiveCard
的简单秒表。
- 计时器:结合使用
Immersion
和 LiveCard
的简单计时器。
如需将其中一个示例导入到 Android Studio 中,请执行以下操作:
- 依次点击 Check out from Version Control > Git。

- 在 Vcs 代码库网址字段中使用示例的克隆网址(例如:
https://github.com/googleglass/gdk-apidemo-sample.git
)。

- 在以下两个屏幕上点击 OK。
- 构建项目,然后点击 Play 按钮,在连接的 Glass 上运行。请务必查看示例的
README
,了解调用详情。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eDevelopers need intermediate or better Android development knowledge to use the Glass Development Kit (GDK).\u003c/p\u003e\n"],["\u003cp\u003eThis guide helps set up the GDK environment, install Glassware, and provides resources for beginners and experts.\u003c/p\u003e\n"],["\u003cp\u003eExperts can quickly get started by installing the Android 4.4.2 SDK, Glass Development Kit Preview, and importing samples.\u003c/p\u003e\n"],["\u003cp\u003eBeginners are encouraged to first build basic Android apps using the provided training resources.\u003c/p\u003e\n"],["\u003cp\u003eSample projects demonstrating GDK APIs are available on GitHub for developers to explore and learn from.\u003c/p\u003e\n"]]],[],null,["# GDK Quick Start\n\nBefore you begin to use the GDK, you need intermediate\nor better knowledge in Android development.\n\nThis quick start gets your environment set up with the GDK\nand shows you how to install your first piece of Glassware.\nCheck out the [pattern guides](/glass/develop/patterns)\nfor detailed information on how to build Glassware.\n\nFor Android experts\n-------------------\n\nIf you're comfortable with Android, here's all you need to know:\n\n1. Get the **Android 4.4.2 (API 19) SDK** and **Glass Development Kit Preview** add-on from the Android SDK Manager.\n2. On Glass, turn on USB debugging (**Settings \\\u003e Device Info \\\u003e Turn on debug**).\n3. Import some [GDK samples](#importing_samples).\n4. When you're ready to create a project for your own Glassware, use these settings:\n - **Compile with: Glass Development Kit Developer Preview**\n - **Theme: None** (ADT and Android Studio usually assign a theme automatically, even if you specify no theme, so remove the `android:theme` property from your manifest after creating a project.)\n5. Head on over to the [pattern guides](/glass/develop/patterns) and [developer guides](/glass/develop/gdk) for more learning.\n\nFor Android beginners\n---------------------\n\nWe recommend starting with the\n[Building Your First App](//developer.android.com/training/basics/firstapp/index.html)\ntraining class at the [Android developers site](//developer.android.com) and then building a\nfew simple Android apps before building GDK Glassware.\n\n### Setting up the development environment\n\n1. We recommend installing [Android Studio](//developer.android.com/sdk/installing/studio.html) for easier development. The rest of these steps assume you have this installed.\n2. Click **Configure \\\u003e SDK Manager**.\n3. Install the **SDK Platform** and **Glass Development Kit Preview** for **Android 4.4.2 (API 19)**. Everything else is optional.\n4. On Glass, go to **Settings \\\u003e Device Info \\\u003e Turn on debug** to enable `adb`, which allows your development system to communicate with Glass.\n5. Connect Glass to your development system and tap on the touchpad to authorize debug access.\n\n### Importing samples\n\nTo help get you started, GDK sample projects are available on our\n[GitHub](https://github.com/googleglass) repository:\n\n- [ApiDemo](https://github.com/googleglass/gdk-apidemo-sample): Gallery of some GDK APIs usage.\n- [Compass](https://github.com/googleglass/gdk-compass-sample): Simple compass using a `LiveCard`.\n- [Stopwatch](https://github.com/googleglass/gdk-stopwatch-sample): Simple stopwatch using a `LiveCard`.\n- [Timer](https://github.com/googleglass/gdk-timer-sample): Simple timer using a combination of `Immersion` and `LiveCard`.\n\nTo import one of the samples into Android Studio:\n\n1. Click **Check out from Version Control \\\u003e Git** .\n2. Use one of the samples' clone URL in the **Vcs Repository URL** field (example: `https://github.com/googleglass/gdk-apidemo-sample.git`).\n3. Click **OK** on the following two screens.\n4. Build the project and run it on your connected Glass by clicking on the **Play** button. Make sure to check the sample's `README` for invocation details."]]