Have anyone tested the ``` javaCompileOptio...
# room
r
Have anyone tested the
Copy code
javaCompileOptions {
            annotationProcessorOptions {
                arguments = [
                        "room.expandProjection":"true"]
            }
        }
setting in gradle to avoid
room
to query db parts that isn't referenced. https://developer.android.com/jetpack/androidx/releases/room When using this setting, I run into this problem when compiling the code:
Copy code
e: C:\AndroidProjects\EmptyFuel\app\build\tmp\kapt3\stubs\debug\no\rogo\emptyfuel\datalayer\dao\StationDao.java:140: error: There is a problem with the query: [SQLITE_ERROR] SQL error or missing database (no such column: stations.stationId)

    public abstract androidx.lifecycle.LiveData<java.util.List<no.rogo.emptyfuel.datalayer.entities.Station>> getLiveStationsWithinMapBounds();

                                                                                                              ^
It runs smooth with set to
room.expandProjection:false
, no errors. This situation is reported in : https://issuetracker.google.com/issues/145231171 source code before compiling (source is kotlin):
Copy code
@Query("SELECT * FROM stations AS s WHERE s.airDistance < :airDistance LIMIT :limit")
  fun getStationsByAirDistance(airDistance: Double, limit: Int):List<Station>?
source code after compiling (compiler converts it to java...)
Copy code
@org.jetbrains.annotations.Nullable()
    @androidx.room.Query(value = "SELECT * FROM stations AS s WHERE s.airDistance < :airDistance LIMIT :limit")
    public abstract java.util.List<no.rogo.emptyfuel.datalayer.entities.Station> getStationsByAirDistance(double airDistance, int limit);
I can't find any errors, but the compiler does...(apparently), only when
room.expandProjection
is set to
true
Please visit the issuetracker link above and take a look ...