android wear - eclipse:不识别支持库 [英] android wear - eclipse : not recognizing support library
问题描述
我已经下载了所需的,包括支持库,并设置了Android Wear。
我遇到的问题是项目无法找到可穿戴的libararies。
代码错误行示例:
WatchActivity无法解析为类型
和
导入android.support.wearable无法解析
谢谢Yakir。
我已经经历了同样的问题使用Eclipse和我的问题的答案是以下链接,我发现:_
。
但是如果要从Eclipse中使用 android.support.wearable
包中的任何类,它有点棘手。
可穿戴包不包括在标准的android-support库中 - 您需要使用位于Google存储库中的可穿戴UI支持库: com.google.android.support:wearable
与标准的android-support lib不同,这个不是一个 .jar
文件或项目代码,您可以直接导入到工作区,但它位于 .aar
格式(如 jar
包括 res
)。
请在这里找到相对于你的sdk文件夹的这个文件:
./ extras / google / m2repository / com / google / android / support / wearable / 1.0.0 / wearable-1.0.0.aar
- 解压缩
wearable-1.0.0.aar
文件到你的工作区(你可以看到它看起来几乎像移动classes.jar
到/libs/classes.jar
- 现在您必须从这些文件创建新项目,包名称定义为
android.support.wearable
- 使用API 20编译并在项目属性中选择是库
- 从项目添加对该库项目的引用
我推荐你来看看这篇博文。有一切都很好地解释了一步一步。如果您有任何项目可以随时在这里发表评论。
Im trying to develop with the new Wear sdk.
I have downloaded everyting needed including support libraries and set up android wear to go. the problem I have is that the project cant find the wearable libararies.
code error lines example:
WatchActivity cannot be resolved to a type
and
The import android.support.wearable cannot be resolved
Thank you, Yakir.
I've gone through the same issues using Eclipse and the answer to my problem was following link that I've found:
http://blog.benjamin-cabe.com/2014/07/04/how-to-setup-eclipse-for-android-wear-development
WatchActivity:
just don't use WatchActivity
- use standard Activity instead.
The import android.support.wearable cannot be resolved:
First step is to make sure that you have installed a Google Repository
Extra in your SDK Manager. It should be located somewhere below the Android Support Repository
After downloading the Google Repository
:
In Android Studio you just need to add a dependency for wearable-support lib like done here: https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary.
But if you want to use any class from android.support.wearable
package from Eclipse it is a little bit tricky.
Wearable package is not included in standard android-support library - you need to use wearable UI support lib located in google repository: com.google.android.support:wearable
Unlike the standard android-support libs, this one is not provided as a .jar
file or project code that you can import right to your workspace, but it's in .aar
format (like jar
but also including res
).
Please find this file here, relative to your sdk folder:
./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar
- Unzip
wearable-1.0.0.aar
file somwehere to your workspace (you can see it looks almost like a standard android project) - Move
classes.jar
to/libs/classes.jar
- Now you have to create new project from these files, with package name defined as
android.support.wearable
- Compile it with API 20 and select "Is Library" in project properties
- Add reference to this library project from your project
I recomment you to take a look at this blog post. There is everything explained well step-by-step. If you will have any project feel free to ask in comment here.
这篇关于android wear - eclipse:不识别支持库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!