Error "Resource identifier not found for attribute" rectLayout ""
I tried to create a new project for android wear in eclipse but there is a problem in the main layout, I am not now, how can I solve it, this is my main layout:
<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>
it gives me this error:
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'
My project has two layouts "rect.xml" and "round.xml" and it compiles with 4.4W and the target is 4.4W and also I have a copy of classes.jar in libs folder.
source to share
The code you posted is fine. The problem is that you have a copy classes.jar
in your folder /libs
, but this is the wrong way to use wearable-support-lib correctly . This wearable-support-lib contains some resources that cannot be packaged inside the file .jar
, so you need to import it as a " Library Project " and attach it to your project like other external libraries.
You need to go back to the file wearable-1.0.0.aar
located in relation to your sdk folder:./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar
- Expand the entire file
wearable-1.0.0.aar
anywhere in your workspace. You will see that it looks almost like a standard android project. - Move
classes.jar
to/libs/classes.jar
- within this project, not your own project. - Now you need to create a new project from these files with the package name
android.support.wearable
. - Compile it with API 20 and check the "Is a library" checkbox in the project properties on the Android tab .
- Add a link to this library project from your project.
You can see more details on using wearable-support-lib in my other answer and in this excellent blog post (Benjamin Cabet).
source to share
What worked for me was changing this: XMLNS: app = "http://schemas.android.com/apk/res-auto"
To: XMLNS: app = "http://schemas.android.com/apk/com.mydomain.myapp"
Where com.mydomain.myapp is the bundle ID of my app.
Presumably the res-auto function didn't work in my project for some reason.
source to share