Android generated files unable to access android libraries

Viewed 274

I have a module in a project that uses Room DB. When I attempt to compile the project, it fails with a series of error messages regarding accessing symbols:

error: package android.content does not exist
import android.content.Context;
error: package android.database does not exist
import android.database.Cursor;
error: package android.os does not exist
import android.os.CancellationSignal;
error: cannot find symbol
symbol: class Cursor

Oddly, this only seems to happen with generated files. (specifically, the generated dao implementation and the generated database implementation) Other files in the same package do not have issues with accessing this.

  • Room version: 2.3.0
  • Android Studio Version: 4.2.1
  • Gradel plugin Version: 6.7.1
1 Answers

Not sure why, but this apparently had something to do with the Java Language Version used in the project. After dropping it down to 1.8 (from 11) this issue just went away.

Related