I am trying to run Android sample applications using intellij idea and R.Java file is missing form notepad samples source directory.
In AndroidStudio use: Build -> Rebuild Project.
And remember, the generated R file is not in the project "gen" directory. It is in the "out" directory (drill down to your project).