Questions tagged [android-room]

For questions related to Android Room Persistence Library (which is a part of Android Architecture Components)

Room provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.

6786 questions
2
votes
2 answers

How to insert a "one to one" room database

I am trying to insert an object with a one to one relationship in android. To be more precise i am trying to follow the example from googles official documentation I am using the two classes User and Library. The problem i have is how to insert the…
2
votes
1 answer

Why is Room not populating database from assets?

I'm trying to copy a pre-populated SQLite database from the assets folder using Room's createFromAssets method. The database is sizeable (one table has ~370k entries; about 18mb total size). The database gets created in the databases folder and it…
Ahnold
  • 157
  • 8
2
votes
1 answer

How can I generate a DB, that fits my room scheme?

I have a database with quite a lot of Entities and I want to preload data from a file, on first creation of the database. For that the scheme of Room needs to fit the scheme of the database file. Since converting the json scheme by hand to SQLite…
2
votes
1 answer

Room Transaction rollback

Accordording to the room documentation transaction rollsback every query in a transaction in case an error occurs. So here I tested the rollback out: @Transaction public Completable updateTable1(Table table1) { return Completable.fromAction( …
Funny Moments
  • 421
  • 2
  • 13
2
votes
2 answers

Task :app:checkDebugDuplicateClasses FAILED issue once after adding Android Room Database to the project

Once after setting up the room database to the project I am getting a build failure with an output Execution failed for task ':app:checkDebugDuplicateClasses'. I am attaching the build output below for reference. Does anybody have an idea on how to…
Cyril David
  • 465
  • 1
  • 4
  • 11
2
votes
0 answers

room.schemaLocation for each flavors

I've a multi flavors project which represents several brands, each with their own database and I'm figuring out a simple way to export a room schema for each of them. e.g: flavor#1 -> "$projectDir/flavor1/schemas" flavor#2 ->…
2
votes
1 answer

Updating two Tables at same time but rollback if update fails

Let's say we have the above diagram. We have two tables, which I want to update.In case one update fails, I want to rollback both updates. I want the best performance, so I realized there is only one solution which I can think…
2
votes
2 answers

Koltin - not enough information to infer type variable t and annotations problems in while creating Room Database Android Studio

I'm new to Android was following the code to create a Room Database in Kotlin through the official Android Documentation . [1]: https://developer.android.com/codelabs/android-room-with-a-view-kotlin#7 MY Database Class- package…
2
votes
1 answer

How to make filter in inner table in android room join query

I have two tables table A and table B, i am making inner join query in android room (A inner join B), but i have to filter data from table B , is that possible in android room?
KIM
  • 31
  • 1
  • 3
2
votes
1 answer

Room - Schema export directory is not provided to the annotation processor so we cannot import the schema

I have updated kotlin plugin to 1.5.20 and this issue happened. If I return it 1.5.10 all works fine. Schema export directory is not provided to the annotation processor so we cannot import the schema. To generate auto migrations, you must provide…
Danijel Markov
  • 160
  • 1
  • 8
2
votes
1 answer

Checking the size of Room database in device settings

How can I find out the size occupied by Room databases by looking at the app settings? The storage section of the app settings is divided into Total, App size, User data and Cache. Does the app database account for the User data section or is it the…
Daehan
  • 55
  • 3
2
votes
2 answers

Convert Database Entity from Java to Kotlin

I am currently converting my projects to Kotlin and I have an app with Room database using Java. My Entity in Java @Entity(tableName = "store") @Fts4 public class Store { @PrimaryKey @ColumnInfo(name = "rowid") private Long…
Rence Rei
  • 473
  • 3
  • 9
2
votes
0 answers

IllegalStateException while fetching all messages from roomdb table

App crashes sometime when it reads all messages from db in background task and user perform delete operation at same time. Stack trace: java.lang.IllegalStateException: Couldn't read row 1426, col 0 from CursorWindow. Make sure the Cursor is…
2
votes
1 answer

RoomDB - Can you JOIN tables from different databases

I'd like to know if RoomDB supports a join from two tables from different databases. Let's say I have the follow entities and databases: @Entity data class Foo( @PrimaryKey val fooId: Long, val barId: Long, val fooText:…
Thomas Cook
  • 4,371
  • 2
  • 25
  • 42
2
votes
2 answers

Relational room database: The class must be either entity or database view

I am trying to understand how to use Room with relational tables. I have created a Job model, that has a list of locations and therefore needs a 1-to-many relation between the Job and Location object. For that, I have created a JobWrapper data class…
7heViking
  • 7,137
  • 11
  • 50
  • 94