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.

+3


source to share


4 answers


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

+5


source


I just added the following code in the dependencies section in the module build.gradle

module: compile 'com.google.android.support:wearable:2.0.3' compile 'com.google.android.gms:play-services-wearable:11.0.0'



+1


source


I was having this problem too, in my case I solved it by right clicking on the AppCompat map and then clicking the refresh button, do it with your project folder.

0


source


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.

0


source







All Articles