title: What is causing the circular dependency?
body: <p>I have looked for hours but i can't find the circular reference in this code. I was hoping somebody could help me find where the error is.</p>
  
  <p>The XML file in question is here;</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
      &lt;LinearLayout android:id="@+id/politics_panel"
          android:layout_height="0dp"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_alignParentLeft="true"
          android:layout_toLeftOf="@+id/leadership_panel"
          android:background="#66FF99" &gt;
  
          &lt;Spinner android:id="@+id/politics_spinner"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
  
          &lt;Button 
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              android:text="@string/ok"
              android:onClick="addCardToTray" /&gt; 
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout android:id="@id/leadership_panel"
          android:layout_height="0dp"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_toLeftOf="@+id/tactics_panel"
          android:layout_toRightOf="@id/politics_panel"
          android:background="#3333CC"&gt;
  
          &lt;Spinner android:id="@+id/leadership_spinner"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
  
          &lt;Button 
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              android:text="@string/ok"
              android:onClick="addCardToTray" /&gt;  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout android:id="@id/tactics_panel"
          android:layout_height="0dp"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_toLeftOf="@+id/piloting_panel"
          android:layout_toRightOf="@id/leadership_panel"
          android:background="#CC3399" &gt;
  
          &lt;Spinner android:id="@+id/tactics_spinner"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
  
          &lt;Button
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              android:text="@string/ok"
              android:onClick="addCardToTray" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout android:id="@id/piloting_panel"
          android:layout_height="0dp"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_toLeftOf="@+id/engineering_panel"
          android:layout_toRightOf="@id/tactics_panel"
          android:background="#FFFF00" &gt;
  
          &lt;Spinner android:id="@+id/piloting_spinner"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
  
          &lt;Button
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              android:text="@string/ok"
              android:onClick="addCardToTray" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout android:id="@id/engineering_panel"
          android:layout_height="0dp"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_alignParentRight="true"
          android:layout_toRightOf="@id/piloting_panel"
          android:background="#990033" &gt;
  
          &lt;Spinner android:id="@+id/engineering_spinner"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
  
          &lt;Button
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              android:text="@string/ok"
              android:onClick="addCardToTray" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The LogCat print out given when i run the code is this;</p>
  
  <pre><code>04-09 21:49:32.834: E/AndroidRuntime(17888): FATAL EXCEPTION: main
  04-09 21:49:32.834: E/AndroidRuntime(17888): java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1321)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:317)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:337)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.View.measure(View.java:15530)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:833)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.View.measure(View.java:15530)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5109)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.View.measure(View.java:15530)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:833)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.View.measure(View.java:15530)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5109)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.View.measure(View.java:15530)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1986)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1227)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1400)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1120)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4604)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.Choreographer.doCallbacks(Choreographer.java:555)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.Choreographer.doFrame(Choreographer.java:525)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.os.Handler.handleCallback(Handler.java:615)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.os.Handler.dispatchMessage(Handler.java:92)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.os.Looper.loop(Looper.java:137)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at android.app.ActivityThread.main(ActivityThread.java:4921)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at java.lang.reflect.Method.invoke(Method.java:511)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
  04-09 21:49:32.834: E/AndroidRuntime(17888):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>