Unlike other posts from here (R is unresolved - #18 by cairomenso for example), my project compiles fine.
There is no Gradle error, I can compile and run on my phone without any warnings, however, IntelliJ Ultimate shows any usage of the R class in red with a “Unresolved reference: R” error. Even code completion works.
I don’t really know where this could come from, so here’s some info about the system:
Debian 9
IntelliJ Ultimate 2018.3.4 with bundled Android Support plugin (the latest version I believe)
The project was created through the wizard. The only modifications I made to the config is to change the Kotlin dependancy from the JRE7 to the JDK7 version:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
About the Gradle wrapper:
------------------------------------------------------------
Gradle 4.10.1
------------------------------------------------------------
Build time: 2018-09-12 11:33:27 UTC
Revision: 76c9179ea9bddc32810f9125ad97c3315c544919
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Linux 4.9.0-8-amd64 amd64
(this project is using a regular Groovy build.gradle).