After pulling the latest source of an android project I am working on from GitHub I got the following error:
MyProject.apk.res not found. Try to rebuild project
But no amount of rebuilding would fix it.
It turned out that the problem was that somehow the Module had lost track of which Android platform it is targeted to. To fix it I did the following:
- Bring up the Project Structure dialog (File/Project Structure or ctrl+alt+shift+s)
- Make sure that Modules is selected in the Project settings pane (far left)
- Expand the node with the name of your project in the middle pane and click on the Android node underneath it. This selects the Android facet.
- At the top of the Facet pane there is a drop-down list which you can use to select your Android platform. If there are no entries in this you can create a new one by clicking ‘New’ and locating the directory your Android SDK is installed in.
- Click Ok and rebuild, the problem should now be fixed
It seems that the problem is caused by Git in some way, but I’m not exactly sure how yet. I’ll update here if I find out why.