title: Android xml error: "No resource found that matches the given name" with RelativeLayout (@id/LinearLayout_acc, @id/ProgressBar_statusScreen)
body: <p>Okay, so this is starting to really annoy me. This error pops up in a very special, not very logical way.</p>
  
  <p>Let me start out by saying that I have already looked at the other questions regarding this error, Google'd it too. As far as I can tell, most similar problems occur because people refer to a <code>String</code> resource or something else not within the same layout file, they misplace the '+' in '@id+' or something similar.</p>
  
  <p>The problem I am having occurs in a layout .xml file with a <code>RelativeLayout</code>. This contains a <code>TableLayout</code>, two <code>LinearLayout</code>s containing some text and finally a <code>ProgressBar</code>. What I want is the progress bar to be aligned with the relative layout using <code>android:layout_alignParentBottom="true"</code> and then align the two linear layouts  above the progress bar (the bottom linear layout aligning above the progress bar, the other aligning above the bottom linear layout).</p>
  
  <p>It should be simple enough and looks as if it works, i.e. the graphic view shows the desired result. However, and <strong>here comes the problem</strong>, Eclipse gives me an error on the two linear layouts,</p>
  
  <p>"Error: No resource found that matches the given name (at 'layout_above' with value '@id/LinearLayout_acc')."</p>
  
  <p>and the same error for the other linear layout referring to the progress bar. I have more than triple checked that there are no typos (the id's also exist in packagename.R.java), and I have tried cleaning the project a dozen times.</p>
  
  <p>I don't get the error when saving (and auto building), not until I decide to run the project. Another weird thing is that when I refer to the bottom linear layout from the progress bar instead of the top linear layout, I get no error!</p>
  
  <p>My layout file:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@drawable/background_activity" &gt;
          &lt;TableLayout
               ... /&gt;
  
          &lt;LinearLayout
              android:id="@+id/LinearLayout_dist"
              android:layout_above="@id/LinearLayout_acc"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true"
              android:layout_marginBottom="10dp" &gt;
  
              &lt;TextView
                  ... /&gt;
  
              &lt;TextView
                  ... /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/LinearLayout_acc"
              android:layout_above="@id/ProgressBar_statusScreen"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true" &gt;
  
              &lt;TextView
                  ... /&gt;
  
              &lt;TextView
                  ... /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;ProgressBar
              android:id="@+id/ProgressBar_statusScreen"
              style="?android:attr/progressBarStyleHorizontal"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_margin="16dp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Please help, I have no idea what causes this error!</p>
  
  <h2>Edit with answers</h2>
  
  <p>Shrikant came with the solution of changing the order of appearance in the layout file so that elements reference only other elements already defined when the reference is read.<br>
  Also, as others have posted, changing <code>@id/</code> to <code>@+id/</code>, even in a reference, does remove the error messages. As Marco W. wrote in <a href="https://stackoverflow.com/questions/5025910/difference-between-id-and-id-in-android">this</a> thread, the thing is you have to use <code>@+id/</code> the first time each id is mentioned and then use <code>@id/</code> afterwards, even though the first time may not be a definition.  </p>
  
  <p>I made most of the design and set the referred id's in Eclipse's graphical editor, so code that resulted in an error message was automatically inserted. Maybe this is a bug in Eclipse.</p>