Abdullah AlHazmy
Abdullah AlHazmy

Reputation: 1299

Error "No resource identifier found for attribute 'rectLayout'"

I was trying to create a new project for android wear in eclipse , but there is a problem in main layout i don't now how i can 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 is give 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 have two layouts "rect.xml" and "round.xml" and it is compile with 4.4W and target is 4.4W and also i have a copy of classes.jar in libs folder .

Upvotes: 3

Views: 4309

Answers (4)

Anthony.
Anthony.

Reputation: 771

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 package id of my app.

Presumably the res-auto functionality was not working in my project for some reason.

Upvotes: 1

SimonIT
SimonIT

Reputation: 21

I just added the following code in the dependency section in my build.gradle of the module: compile 'com.google.android.support:wearable:2.0.3' compile 'com.google.android.gms:play-services-wearable:11.0.0'

Upvotes: 1

Maciej Ciemięga
Maciej Ciemięga

Reputation: 10713

The code you've posted is fine. The problem here is that you have a copy of classes.jar in your /libs folder, but this is not a right way to properly use wearable-support-lib. This wearable-support-lib contains some resources that cannot be packaged inside a .jar file, so you need to import it as a "Library project" and attach it to your project just like other external libraries.

You need to go back to the wearable-1.0.0.aar file, located in relation to your sdk folder:
./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar

  1. Unzip the whole wearable-1.0.0.aar file somwehere to your workspace. You will see that it looks almost like a standard android project.
  2. Move classes.jar to /libs/classes.jar - inside this project, not to your own project.
  3. Now you have to create new project from these files, with package name defined android.support.wearable.
  4. Compile it with API 20 and check "Is Library" in project properties in Android tab.
  5. Add reference to this library project from your project.

You can see more details about using wearable-support-lib in my other answer and in this great blog post (by Benjamin Cabé).

Upvotes: 5

Bart1612
Bart1612

Reputation: 178

I got this problem too sometimes, in my case i solved it by rightclicking on the AppCompat map then click on refresh, do this with your projectfolder too.

Upvotes: 0

Related Questions