I lost my R file.?I don't know what happened.?
-
16-06-2021 - |
Question
I was working on my android project. After completing some coding, I imported remaining classes by pressing ctrl+shift+o
. Than I cleaned my project. After cleaning the project I lost my BuildConfig.java
file.
How can i get it back?
I think that R.java is now renamed as BuildConfig.java.(For all developers)
Am i right?
Thank you in advance.
Solution
Make sure you haven't imported an foreign R
file. Occasionally, CTRL+SHIFT+O
will import android.R
which will mess up your project. Delete the import statement, clean and build your project again.
OTHER TIPS
You should have an BuildConfig.java and an R.java in your gen folder (inside your package).
If the R.java isn't generated after cleaning, make sure that you don't have any errors in your layouts. (An layout error will cause the R to be removed and not to come back before a clean :) )
Clean the project 2-3 times. It will work.