We are actively working on a Glass Development Kit (GDK) that allows you to build Glassware in the form of APKs. We’re still hard at work on the GDK, but in the meantime, you can start designing and developing your awesome ideas with the existing Android SDK. Although you won’t have all the tools necessary to design the perfect experience for Glass, developing with the Android SDK lets you try out ideas while you wait for the GDK.
Glass is built on the Android 4.0.4 platform, so you can write APKs using the standard Android SDK (API Level 15) and sideload them onto Glass. The Android SDK provides you with a wide range of APIs to do things such as access the low-level hardware, render OpenGL, use stock Android UI widgets, and much more. You can even use the Android NDK to develop.
We encourage you to start developing APKs for Glass and experiment with what you can do. For more information on utilizing the Android platform and if you're adventurous, gaining root shell access, see the Void Your Warranty Google I/O session video.
Samples
All of our APK samples are available on GitHub and we will be adding more. When we launch the GDK, we'll also update these samples to show the migration path from a traditional Android app to a full Glass experience. Make sure to check regularly for updates:
PrerequisitesA good understanding of Android development. See the
Android developer training site for information on how to get started. Because Glass is built on the Android platform, you can use many Android resources that are already published for help.Android SDK - This is needed for development.Glass - You can push the code to an Android device or emulator but to design a real Glass experience, you need the actual device.
Importing and compiling the samples
Checkout the samples onto your filesystem and use your favorite IDE to import and compile the code.
In Eclipse and ADTClick
File > Import ... > Existing Android Code into Workspace.Click **Browse**, select the location of the apk-[sampleName]-sample/ directory, and click **OK**.Select the **apk-[sampleName]-sample** project to import it and select **Copy projects into workspace**.Click **Finish** to complete the import.
In Android StudioCheckout the sample to a location where you keep your Android development projects. A apk-[sampleName]-sample/ directory is created.Click
File > Import Project ..., select the location of the apk-[sampleName]-sample/ directory, and click **Next** until you see the **Finish** button.Click **Finish** to complete the import.
Turning on debug mode
You'll need to turn on debug mode before you do any type of development on Glass. Go to **Settings > Device Info > Turn on debug** to enable it.
Running the APK on Glass
You can use your IDE to compile, install, and run the APK or use adb on the command line:
$ adb install -r [sampleName].apk
$ adb shell am start -n com.google.glass.samples.<sampleName>/.<MainActivityName>
本博客指导您如何利用现有的Android SDK为Glass设备开发应用程序,即使在等待Glass Development Kit (GDK) 的同时,您也可以开始设计和开发您的创意。通过Android SDK,您可以访问一系列API来操作硬件、渲染OpenGL、使用Android UI组件等。此外,了解如何使用Android NDK进行开发,以及如何从传统的Android应用迁移到完整的Glass体验。提供详细的步骤,包括如何导入和编译样本代码,以及如何在Glass上运行APK。
6625

被折叠的 条评论
为什么被折叠?



