Current JDK version 1.8 has a bug that prevents Room from being incremental
you will need to using JDK embedded with AS to solve this. make sure to use AS 3.5 above.On project structure -> SDK locationmake sure jdk is pointed to jdk shipped with AS./Applications/Android Studio.app/Contents/jre/jdk/Contents/HomeThen you will need to restart your AS.
If you running from terminal make sure $JAVA_HOME contains correct path.
I guess Android studio not supporting JDK 11 yet. I also tried to use latest JDK 8 (231, which AS 3.5 using 202) but it causing this issue.
When compiling, it showed me a warning:
Current JDK version has a bug (https://bugs.openjdk.java.net/browse/JDK-8007720) that prevents Room from being incremental. Consider using JDK 11+ or the embedded JDK shipped with Android Studio 3.5+.Note: 1 Wrote GeneratedAppGlideModule with: [][WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).
Then I downloaded JDK 8 (8u261) from the Oracle site (it requies registration, so look for a direct link).
Installed it, changed JAVA_HOME
system variable to a new path:
Then recompiled the app. Even restart wasn't required.
UPDATE
After a month I again saw the same warning. Then read the accepted answer and found Java embedded with Android Studio: C:\Program Files\Android\Android Studio\jre
.
File > Project Structure...
, then SDK Location
, and in the field JDK location
wrote that path. Restarted AS.
Setting $JAVA_HOME
to /Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home
for my shell helped me.