Error: Resource ID not found for attribute "roundLayout" in package "package name"

I have a problem with the following app attribute: RectLayout and app: Roundlayout, it gives errors in the xml saying that there is

Multiple annotations found at this line: - error: No resource identifier found for attribute 'roundLayout' in package 'com.rarster.demowearman' - error: No resource identifier found for attribute 'rectLayout' in package 'com.rarster.demowearman''

,

and then also gives an error in my main activity saying R cannot be resolved to a variable, I am following this tutorial https://medium.com/@tangtungai/how-to-develop-and-package-android-wear-app -using-eclipse-ef1b34126a5d , I have verified that I have roundlayout and rectlayout in my layout folder. Can anyone tell me what is going on and how to fix it? thanks in advance

the code the error is in is

    <?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
    android:layout_height="wrap_content"
    app:rectLayout="@layout/rect"
    app:roundLayout="@layout/round"
    tools:context="com.rarster.demowearman.MainActivity"
    tools:deviceIds="wear" >

</android.support.wearable.view.WatchViewStub>

      

+3


source to share


1 answer


  • All xml attributes start with a lowercase letter.
  • Neither should app:rectLayout

    nor app:roundLayout

    should it be placed in the manifest! They must be used in the layout - in the parent view WatchViewStub

    .

Like:



<android.support.wearable.view.WatchViewStub
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/stub"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    app:rectLayout="@layout/rect"
    app:roundLayout="@layout/round"
    />

      

Your error R cannot be resolved to a variable

is the result of incorrect resource files - they cannot be compiled. So please correct everything above and everything should be fine.

+2


source







All Articles