Android的磨损 - 月食:不承认支持库月食、磨损、不承认、Android

2023-09-04 11:35:29 作者:爱上、孤独

我试着去建立与新服SDK。

Im trying to develop with the new Wear sdk.

我已经下载需要,包括支持库,并建立了机器人穿去everyting。 我的问题是,该项目无法找到可穿戴函数库,

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错误行的例子:

code error lines example:

WatchActivity cannot be resolved to a type

The import android.support.wearable cannot be resolved

感谢您,亚基尔。

推荐答案

我已经通过我发现使用Eclipse和回答我的问题下面的链接相同的问题了: http://blog.benjamin-cabe.com/2014/07/04/how-to-setup-eclipse-for-android-wear-development

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.

第一步是要确保你已经在你的SDK管理器中安装了谷歌信息库附加。它应位于什么地方下的 Android的支持库 下载后的谷歌信息库: 在Android的工作室,你只需要添加一个依赖于可穿戴支持LIB喜欢这里做:https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary. 但是,如果你想从Eclipse中使用任何类从 android.support.wearable 包这是一个有点棘手。 耐磨包不包含在标准Android支持库 - 你需要使用位于谷歌库可穿戴式UI支持lib目录下: com.google.android.support:wearable 不同于标准的Andr​​oid支持库,这个人是不是作为一个的.jar 文件或项目code,你可以导入到您的工作空间,但它在 .aar 格式(如也包括 RES )。

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).

请找到该文件在这里,相对于你的SDK文件夹: ./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar

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

解压缩耐磨-1.0.0.aar 文件somwehere到您的工作空间(你可以看到它看起来就像一个标准的Andr​​oid项目) 将 classes.jar /libs/classes.jar 现在,你必须创建这些文件的新项目,定义为 android.support.wearable 包的名称 与API 20进行编译,然后在项目属性库 添加引用该库项目从项目 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.