查看Google Glass 笔记的源代码
←
Google Glass 笔记
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== 编译测试环境 == 从 http://www.gradle.org 下载 gradle-1.11-bin.zip ,这是 android app 的命令行编译框架 解压到 /work/glass/gradle/gradle-1.11 用 Android SDK Manager 安装 Android 4.0.3 (API 15) SDK 和 Glass Development Kit Sneak Peek,以及 Android Build Tools 19.0.3,Android SDK 目录位于:/work/android/sdk/android-sdk-linux ~/.bashrc 中导出环境变量: <source lang=bash> # gradle for build android/glass export PATH=/work/glass/gradle/gradle-1.11/bin:$PATH export ANDROID_HOME=/work/android/sdk/android-sdk-linux </source> 建立工作目录,clone GDK的例子代码: <source lang=bash> $ mkdir glass && cd glass $ echo "include ':compass'" > settings.gradle $ git clone https://github.com/googleglass/apk-compass-sample.git compass $ cd compass </source> 建一个如下名为 build.gradle 文件,放在 compass/ 目录下: <pre> buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.1' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion "Google Inc.:Glass Development Kit Sneak Peek:15" buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 15 targetSdkVersion 15 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } instrumentTest.setRoot('tests') debug.setRoot('build-types/debug') release.setRoot('build-types/release') } signingConfigs { debug { storeFile file(System.getenv("DEBUG_KEYSTORE")) storePassword 'android' # ------> 与 keytool 生成密钥对的密码一致 keyAlias 'mykey' keyPassword 'android' } } buildTypes { debug { // Using release config... signingConfig signingConfigs.debug } } } </pre> keytool 生成一个 key 文件,生成时所有的密码都为 android,cp 为 /home/comcat/.android/my-debug.keystore <source lang=bash> $ keytool --genkeypair Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: Jack Tan What is the name of your organizational unit? [Unknown]: Jack's Lab What is the name of your organization? [Unknown]: Jack's Lab What is the name of your City or Locality? [Unknown]: Beijing What is the name of your State or Province? [Unknown]: Beijing What is the two-letter country code for this unit? [Unknown]: CN Is CN=Jack Tan, OU=Jack's Lab, O=Jack's Lab, L=Beijing, ST=Beijing, C=CN correct? [no]: yes Enter key password for <mykey> (RETURN if same as keystore password): Re-enter new password: $ cp ~/.keystore ~/.android/my-debug.keystore </source> ~/.bashrc 中导出环境变量: export DEBUG_KEYSTORE=/home/comcat/.android/my-debug.keystore 在 glass/ 目录下执行: $ gradle build 运行,google glass 没有模拟器,只能push到实体硬件上去测试: 要让adb发现glass,得打开glass的调试模式: <pre> 进入 Settings card ---> 'Device Info' card ---> 'Turn on debug' $ adb devices List of devices attached 0256E86EE2500E920 device </pre> 安装: <source lang=bash> $ adb install -r compass/build/apk/compass-debug.apk $ adb shell am start -n com.google.glass.samples.compass/.CompassActivity </source> 查看安装的APP: <source lang=bash> $ adb shell pm list packages | grep jacks package:com.jackslab.helloworld </source> 卸载: <source lang=bash> $ adb uninstall com.jackslab.helloworld Success </source> <br><br>
返回到
Google Glass 笔记
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面