[英]Error “No resource identifier found for attribute 'rectLayout'”
我試圖在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的副本。
您發布的代碼很好。 這里的問題是你的/libs
文件夾中有一個classes.jar
的副本,但這不是正確使用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
。 您可以在我的其他答案和本篇博文 (BenjaminCabé)中看到有關使用wearable-support-lib的更多詳細信息。
我剛剛在模塊的build.gradle
中的依賴項部分添加了以下代碼: build.gradle
: build.gradle
: build.gradle
compile 'com.google.android.support:wearable:2.0.3' compile 'com.google.android.gms:play-services-wearable:11.0.0'
我有時也遇到這個問題,在我的情況下,我通過右鍵單擊AppCompat地圖然后點擊刷新來解決它,也可以使用你的項目文件夾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.