android fails to find layout resource for fixed orientation activity
<p>I have an app that is fixed to landscape orientation using the following attributes on all my  elements:</p>

<pre><code>android:screenOrientation="sensorLandscape"
android:configChanges="orientation|screenLayout"
</code></pre>

<p>All my activity layout files are in the <strong>layout-land/</strong> folder, rather than in <strong>layout/</strong></p>

<p>This all works fine, but when testing on a Galaxy Tab running Android 3.1, I get this exception if I launch the app when the tablet is in portrait orientation:</p>

<pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.MainMenu}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030006
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
     at android.app.ActivityThread.access$1500(ActivityThread.java:122)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:132)
     at android.app.ActivityThread.main(ActivityThread.java:4028)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:491)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
     at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030006
     at android.content.res.Resources.getValue(Resources.java:1014)
     at android.content.res.Resources.loadXmlResourceParser(Resources.java:2039)
     at android.content.res.Resources.getLayout(Resources.java:853)
     at android.view.LayoutInflater.inflate(LayoutInflater.java:389)
     at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:242)
     at android.app.Activity.setContentView(Activity.java:1780)
     at com.myapp.MainMenu.onCreate(MainMenu.java:77)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
     ... 11 more
</code></pre>

<p>It is happening on this call to <em>setContentView()</em> in the <em>onCreate()</em> method of my initial activity:</p>

<p>setContentView(R.layout.mainmenu);</p>

<p>I was able to fix the problem by copying all my layout files from <strong>layout-land/</strong> into <strong>layout/</strong>, but it doesn't seem like a very good solution since I now have two sets of layout files that will have to be kept in sync.  Even more curiously, logging the value of getRequestedOrientation() right before the exception occurs shows that is returning 6 (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE).  So, I have no idea why <em>setContentView()</em> isn't looking in <strong>layout-land/</strong></p>

<p>I don't see this problem when launching the app in portrait on a 2.3 phone, but launching it while the phone's screen is off yields an essentially identical exception, which is also fixed by copying the layout files into <strong>layout/</strong> .</p>

<p>Has anyone else seen this error?  Perhaps there is a better way to fix it?</p>
