You need to use the autoGenerate
property
Your primary key annotation should be like this:
@PrimaryKey(autoGenerate = true)
Reference for PrimaryKey.
More Related Contents:
- Android Room – simple select query – Cannot access database on the main thread
- Room Persistence: Error:Entities and Pojos must have a usable public constructor
- Android Room – Select query with LIKE
- How can I represent a “many to many” relation with Android Room when column names are same?
- How to save enum field in the database room?
- Print nubers 1, 3, 6, 10, 15, 21 from a given range using Kotlin [closed]
- How to add image background in button Android studio
- Updating Paging 3 alpha to stable cause indexing issue Android
- Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0
- Error:Execution failed for task ‘:app:compileDebugKotlin’. > Compilation error. See log for more details
- IllegalArgumentException: navigation destination xxx is unknown to this NavController
- Dependancy error when integrating android studio project with Firebase for a google sign in feature
- Opening Android Settings programmatically
- Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException
- android.view.View.systemUiVisibility deprecated. What is the replacement?
- How to call a function after delay in Kotlin?
- A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
- Kotlin and Firebase read and write data
- Room – LiveData observer does not trigger when database is updated
- How to use Data Binding and Kotlin in Android Studio 3.0.0
- “Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16”
- How to add firebase database rules without authentication?
- How to get exact size without recomposition?
- Suspend function ‘callGetApi’ should be called only from a coroutine or another suspend function
- JaCoCo returning 0% Coverage with Kotlin and Android 3.0
- Close/hide the Android Soft Keyboard with Kotlin
- How I can retrieve current fragment in NavHostFragment?
- Kotlin Coroutines the right way in Android
- FragmentTransaction hide/show doesn’t work sometimes
- kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead