我试图在eclipse中为android佩戴创建一个新项目,但是在主要布局中存在一个问题我现在不知道如何解决它,这是我的主要布局:
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect"
app:roundLayout="@layout/round"
tools:context=".MyActivity"
tools:deviceIds="wear">
</android.support.wearable.view.WatchViewStub>
它给我这个错误:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'rectLayout' in package
'com.example.wear'
- error: No resource identifier found for attribute 'roundLayout' in package
'com.example.wear'
我的项目有两个布局“rect.xml”和“round.xml”,它用4.4W编译,目标是4.4W,我在libs文件夹中也有classes.jar的副本。
答案 0 :(得分:5)
您发布的代码很好。这里的问题是您的classes.jar
文件夹中有/libs
的副本,但这不是正确使用 wearable-support-lib 的正确方法。此 wearable-support-lib 包含一些无法打包在.jar
文件中的资源,因此您需要将其作为“图书馆项目”导入并附加就像其他外部库一样,它可以用于您的项目。
您需要返回与您的sdk文件夹相关的wearable-1.0.0.aar
文件:
./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar
wearable-1.0.0.aar
文件解压缩到您的工作区。你会发现它看起来几乎像一个标准的android项目。classes.jar
移至/libs/classes.jar
- 在此项目内,而不是您自己的项目。android.support.wearable
。您可以在other answer和this great blog post(由BenjaminCabé)中查看有关使用 wearable-support-lib 的更多详细信息。
答案 1 :(得分:1)
我刚刚在模块的build.gradle
的依赖项部分添加了以下代码:
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.google.android.gms:play-services-wearable:11.0.0'
答案 2 :(得分:0)
我有时也遇到这个问题,在我的情况下,我通过右键点击AppCompat地图然后点击刷新来解决它,也可以使用你的项目文件夹。
答案 3 :(得分:0)
对我有用的是更改此设置: xmlns:app =“ http://schemas.android.com/apk/res-auto”
收件人: xmlns:app =“ http://schemas.android.com/apk/com.mydomain.myapp”
其中com.mydomain.myapp是我的应用程序的程序包ID。
大概是由于某些原因,res-auto功能在我的项目中无法正常工作。