Java / Android Developer, Trainer, Writer, Speaker

Saturday, November 8, 2014

Like the article?

Hello  Android developers! This is one of the common problems in Android Application development. Just previous day, while I was developing 7 March Speech Application, I faced this problem for a awkward reason. Normally, this is not a big problem but this hurts. This could be happening for few reasons. I'll tell about the problems and solution as well as.
Basically, when you start and open a project java automatically generates a folder file called 'gen'. After your build there are a file generated called , but if your have error in somewhere that couldn't be generated and problem appears.

R.JAVA file

Read More: Google Play New Android SDK Setup for AdMob ( AdSense )

Point 1: First of all, this happens mostly if you have an error in your any of XML file. So, first check your XML files ( could be in layout folder, because you edit that most ) and solve the red pointed error. Solve the error the problem will be gone.

Point 2: Sometimes, after fixing error, this could show up again and again. Just go to Project > clean project and clear the project. You can restart your ADT ( Android development Tools )

Point 3: In my previous project, I named 'if' an image and kept it to my resources folder. The problem R cannot be resolved to a variable type appeared for that! As soon as i renamed the file, the problem went away. Clean and build again.

Point 4: Name your files careful, like your new XML file, new image. This error could be appearing for that too. Write your resource names in lower case, make sure those are not conflicting with anything. You won't find R cannot be resolved to a variable type anymore.

Read More: Career in Mobile Application Development for You : My Experience

Point 5: Make sure your are working with latest SDK  ( Software Development Kit ). Go to menu and click on SDK manager. Check if any update are available. If available, make sure you updates those. That could be a reason for this error too.

Point 6: Make sure you ADT (  Android Development  Tools ) are latest and updated. This could help the error to come up.

Point 7: Right click on your project. Go to Java Build Path. Then, in Order and Export tab look for your latest Android version ( Ex: Android 5.0 ), check that and click OK. Then from your

Point 8: After making changes don't forget to clean your project and then build.

Those are Eight points with eight various problems. You could create a  new one and face this problem! Just kidding g :P If you find anything new on this type problem, don’t forget to leave a comment. Share this post for others. Others will help you too.

Happy Programming, Happy developing!

Read More: 9 Ideas for Career ( Online Money Making ) based on your Love


  1. Just got my check for over $500.

    Many times people don't believe me when I tell them about how much money you can earn filling out paid surveys online...

    So I show them a video of myself getting paid $500 for doing paid surveys.


    Professional trading signals delivered to your mobile phone every day.

    Start following our signals NOW and earn up to 270% per day.