Note that there are some explanatory texts on larger screens.

plurals
  1. POR.java file deleting itself
    text
    copied!<p>I have a slight issue. When I add items to the menu.xml file, the R.java file in the gen folder does not generate. I've used the same code before and no problems have arisen. I am using Eclipse with the ADT plugin on Windows 7. </p> <p>Here is the menu.xml file code:</p> <pre><code>&lt;menu 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" tools:context="com.andrewq.planets.MainActivity" &gt; &lt;item android:id="@+id/action_about" android:icon="@drawable/action_about" android:title="@string/action_about" android:orderInCategory="1" android:showAsAction="always"/&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderInCategory="100" app:showAsAction="never" /&gt; &lt;/menu&gt; </code></pre> <p>And here is the code used in MainActivity.java:</p> <pre><code>//Method used to inflate the menu @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } //Method used to add items to the menu @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.action_about: aboutMenuItem(); break; case R.id.action_settings: Intent intent = new Intent(getApplicationContext(), Settings.class); startActivity(intent); break; } return super.onOptionsItemSelected(item); } </code></pre> <p>FYI -- Here is some Manifest information:</p> <pre><code>&lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /&gt; </code></pre> <p>EDIT: The problem seems to arise when the items are added to the menu.xml files. If I delete the items, it just says it can't find <code>action_about</code> or <code>action_settings</code> whereas when the items are there the R.java file disappears.</p> <p>EDIT #2: Here are some screenshots of code setup:</p> <blockquote> <p>Here is a picture of the XML code with the items commented out.</p> </blockquote> <p><img src="https://i.stack.imgur.com/oR5Fv.png" alt="XML Items commented out"></p> <blockquote> <p>And the Java code while items are commented out says that it can't find action_settings or action_about:</p> </blockquote> <p><img src="https://i.stack.imgur.com/FxvLF.png" alt="Java code while commented out"></p> <blockquote> <p>And finally, the errors output while items are commented out:</p> </blockquote> <p><img src="https://i.stack.imgur.com/f95QH.png" alt="errors while commented out"></p> <p><br> <br></p> <p>Now if I take the comment brackets out like so:</p> <p><img src="https://i.stack.imgur.com/CS8O4.png" alt="uncommented"></p> <p>The following errors arise which can't seem to be solved:</p> <p><img src="https://i.stack.imgur.com/W7qj9.png" alt="uncommented errors"></p> <p><br> I hope this can help someone solve my problem. I've never had this problem before.</p> <p>Thanks, <br> Andrew</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload