Search code examples
androidandroid-studioandroid-activitykotlin

New kotlin files in old java project - 'Unresolved reference' R


Have an already existing java project. Trying to add new kotlin files to it. AndroidStudio 3.1 complains that R is an "Unresolved reference".

I can manually import R and it builds without error. But why is R not automatically imported as always?

Edit- clean&build or restarting AS didnot help.


Solution

  • In AS Preferences, under General -> Auto Import, i enabled the following. enter image description here

    This imports R automatically now.