Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android R file not generating

I know there are a lot of threads about this but I couldn't find one that solved my problem or is a duplicate.

So I was working on an app, accidently made the mistake of cleaning my project. This caused my R.java file to disappear. I tried cleaning my project again, building it again, closing eclipse, deleting the gen folder, checking all of my xml files for errors, all of that.

Problem now is whenever I create a new completely blank application project that doesn't even generate an R file automatically. I'm hoping there is still a way to restore it for my original project but as I stated nothing seems to work.

like image 869
Ryan Sayles Avatar asked May 24 '13 01:05

Ryan Sayles


People also ask

How is the r file generated in Android Studio?

Android R. java is an auto-generated file by aapt (Android Asset Packaging Tool) that contains resource IDs for all the resources of res/ directory. If you create any component in the activity_main. xml file, id for the corresponding component is automatically created in this file.

What is R package in Android?

R is a class containing the definitions for all resources of a particular application package. It is in the namespace of the application package. For example, if you say in your manifest your package name is com. foo. bar , an R class is generated with the symbols of all your resources in com.


1 Answers

It could be if you have deleted

  <string name="action_settings">Settings</string>

in the strings.xml, but not deleted main.xml file in the menu folder.

like image 115
Andrew Avatar answered Oct 14 '22 07:10

Andrew