[英]Google Glass: GDK with Android Studio
I'm trying to use the new Google Glass Development kit with Android Studio. 我正在尝试将新的Google Glass开发套件与Android Studio配合使用。 Unfortunately I'm not having much success. 不幸的是,我没有取得多大成功。
I get the error: "Gradle: package com.google.android.glass.touchpad does not exist" 我收到错误:“Gradle:package com.google.android.glass.touchpad不存在”
I've added uses-library to the manifest as follows: 我已经将清单中的uses-library添加如下:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme" >
<uses-library
android:name="com.google.android.glass"
android:required="true" />
<activity
android:name="com.glass.test.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Then I've added the gdk.jar to the libs directory. 然后我将gdk.jar添加到libs目录中。 And I've added the following to the dependency section of my build.gradle. 我已将以下内容添加到build.gradle的依赖项部分。
dependencies {
compile files('libs/gdk.jar')
}
Any help with this would be very appreciated. 任何帮助都将非常感激。
Change the compileSdkVersion
in your build.gradle
file to refer directly to the GDK add-on: 更改compileSdkVersion
在你build.gradle
文件中直接引用GDK附加:
android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "19.0.2"
// other stuff...
}
(The buildToolsVersion
can be newer than 19.0.2 if you have a higher version of the SDK installed, as long as it's at least 19.0.2.) (如果安装了更高版本的SDK, buildToolsVersion
可能比19.0.2更新,只要它至少为19.0.2。)
Today is 1/10/2015, and from now on, the best option becomes: 今天是2015年1月10日,从现在开始,最好的选择是:
Change the compileSdkVersion in your build.gradle file to refer directly to the GDK add-on: 更改build.gradle文件中的compileSdkVersion以直接引用GDK加载项:
android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "19.1.0"
// other stuff...
}
You should install 19.1.0 build tools first. 您应该首先安装19.1.0构建工具。
did you try right clicking on the jar in the libs folder and hitting "add as library"? 您是否尝试右键单击libs文件夹中的jar并点击“add as library”?
EDIT: I've found that you have to do that in addition to adding it in module settings and the build.gradle. 编辑:我发现除了在模块设置和build.gradle中添加它之外,你还必须这样做。 Also a clean/rebuild with gradle may make it work as well. 使用gradle进行清洁/重建也可以使其正常工作。
After KitKat, changing compileSdkVersion
to "Google Inc.:Glass Development Kit Preview:19" worked for me. 在KitKat之后,将compileSdkVersion
更改为“Google Inc.:Glass Development Kit Preview:19”为我工作。 Note: I also had to restart Android Studio after installing the GDK Preview from it's built in SDK Manager. 注意:我还必须在内置SDK Manager中安装GDK Preview后重新启动Android Studio。 The GDK Preview wasn't recognized by Android Studio until I restarted. 在我重新启动之前,Android Studio无法识别GDK预览。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.