I'm trying to use IntelliJ IDEA to work on an Android app with a colleague that swears by it, but I'm unable to build any of the Android projects he sends me because whenever I try a build I get an error saying package R does not exist
.
I have been trying out everything I can think of. Examples and other things to note are:
Making sure I have a version of the
local.properties
file pointing to the root of my Android SDKs folder.Fiddling with various settings in the project structure dialog (I won't list them all).
The project I'm working on has two library projects with also use the
R
class and they work fine.The intellisense within the IDE recognises the
R
class and comes up with the stuff I expect.
Any help would be greatly appreciated. I feel I'm missing something basic.
To all the hopeless people who have reached this far down the answers: I feel your pain. I have spent an hour doing nothing but trying all those things above as well as proposals from other sources. I have checked all my xml resources twice, cleaned caches, rebuilt a dozen times, even restarted the entire machine. Here is what actually worked for me:
Under 'Build Variants' (lower left corner), I selected a different Build Variant (in my case release instead of debug) for the target that had the missing R problem. Solved it.