I am trying to use Room in my project. Gradle syncing files well, but I get RunitomeException when trying to get database instance.
"Caused by: java.lang.RuntimeException: cannot find implementation for com.fillooow.android.testtochka.BusinessLogic.database.GithubUserSearchDataBase. GithubUserSearchDataBase_Impl does not exist"
I searched this issue and find that solution is to add this lines into build.gradle file:
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
and also aply this plugin
apply plugin: 'kotlin-kapt'
But this is my build.gradle file, and I still have this issue:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.fillooow.android.testtochka"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-kotlin:2.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.vk:androidsdk:1.6.9'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
}
And this is DataBase class
import android.arch.persistence.room.Room
import android.arch.persistence.room.RoomDatabase
import android.content.Context
abstract class GithubUserSearchDataBase : RoomDatabase(){
abstract fun githubUserSearchDataDao(): GithubUserSearchDataDao
companion object {
private var INSTANCE: GithubUserSearchDataBase? = null
fun getInstance(context: Context): GithubUserSearchDataBase?{
if (INSTANCE == null){
synchronized(GithubUserSearchDataBase::class){
INSTANCE = Room.databaseBuilder(context.applicationContext,
GithubUserSearchDataBase::class.java,
"github.db")
.build()
}
}
return INSTANCE
}
fun destroyInstance(){
INSTANCE = null
}
}
}
Project were cleared and rebuild a lot of times.
So, maybe I missed something?
Your gradle file looks fine. Just be sure to Sync it after you have added the proper imports.
What you are missing is the #Database annotation on top of your Database class.
#Database(entities = [Entity1::class, Entity2::class, Entity3::class, Entity4::class], version = 1)
abstract class GithubUserSearchDataBase : RoomDatabase(){
abstract fun githubUserSearchDataDao(): GithubUserSearchDataDao
companion object {
private var INSTANCE: GithubUserSearchDataBase? = null
fun getInstance(context: Context): GithubUserSearchDataBase?{
if (INSTANCE == null){
synchronized(GithubUserSearchDataBase::class){
INSTANCE = Room.databaseBuilder(context.applicationContext,
GithubUserSearchDataBase::class.java,
"github.db")
.build()
}
}
return INSTANCE
}
fun destroyInstance(){
INSTANCE = null
}
}
}
In the entities attribute of the #Database annotation you must put an array with all the classes of your model annotated with the #Entity annotation. I put there fake names, you should put the proper ones.
Related
Please help. I use room. But I have such a mistake. If you remove this code
#Database(
entities = [Current::class],
version = 1
)
But I definitely need it to be in my code otherwise everything will be wrong.
This my ForecastDatabase.kt
package com.ggenius.whattowearkotlin.data.db
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.ggenius.whattowearkotlin.data.db.entity.Current
#Database(
entities = [Current::class],
version = 1
)
abstract class ForecastDatabase : RoomDatabase() {
abstract fun currentWeatherDao(): CurrentWeatherDao
companion object {
#Volatile private var instance: ForecastDatabase? = null
private val LOCK = Any()
operator fun invoke(context: Context) = instance ?: synchronized(LOCK) {
instance ?: buildDatabase(context).also { instance = it }
}
private fun buildDatabase(context: Context) =
Room.databaseBuilder(context.applicationContext,
ForecastDatabase::class.java, "forecast.db")
.build()
}
}
Its my gradle. Check Room
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.ggenius.whattowearkotlin"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleDependency
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.1'
// Navigation
implementation "android.arch.navigation:navigation-fragment:$navigation_version"
implementation "android.arch.navigation:navigation-ui:$navigation_version"
implementation "android.arch.navigation:navigation-fragment-ktx:$navigation_version"
implementation "android.arch.navigation:navigation-ui-ktx:$navigation_version"
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.3"
// Room
//noinspection GradleDependency
implementation "androidx.room:room-runtime:2.4.0-beta01"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
kapt "androidx.room:room-compiler:$room_version"
// Gson
implementation "com.google.code.gson:gson:2.8.6"
// Kotlin Android Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
// ViewModel
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
//noinspection GradleDependency
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
//noinspection LifecycleAnnotationProcessorWithJava8
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// Kodein
implementation "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
implementation "org.kodein.di:kodein-di-framework-android-x:$kodein_version"
// Better dateTime-time support even on older Android versions
implementation "com.jakewharton.threetenabp:threetenabp:1.1.0"
// Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
// Groupie RecyclerView
implementation 'com.xwray:groupie:2.7.0'
implementation 'com.xwray:groupie-kotlin-android-extensions:2.7.0'
// Preference
implementation "androidx.preference:preference:1.1.1"
// WeatherLocation
implementation "com.google.android.gms:play-services-location:19.0.1"
// New Material Design
implementation "com.google.android.material:material:1.5.0"
//test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
In this screenshot, there is an error due to which my application does not start
enter image description here
You don't appear to have implementation 'androidx.room:room-ktx:2.4.0' in the build gradle.
This is what I'm seeing when I try to build my project. I haven't changed anything except what Android forced me to in the Manifest and I don't know where to go after this.
Dao
#Dao
interface SubscriberDAO {
#Insert
suspend fun insertSubscriber(subscriber: Subscriber): Long
#Update
suspend fun updateSubscriber(subscriber: Subscriber): Int
#Delete
suspend fun deleteSubscriber(subscriber: Subscriber): Int
#Query("DELETE FROM subscriber_data_table")
suspend fun deleteAll(): Int
#Query("SELECT * FROM subscriber_data_table")
fun getAllSubscribers(): LiveData<List<Subscriber>>
}
What is wrong?
I tried to change the TargetSdk back to 30 and it still didn't work
Gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.homeofficeprojects.samplearchitecturedatabasecoroutinesproject"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures{
dataBinding = true
// for view binding :
// viewBinding = true
}
/*dataBinding{
enabled = true
}*/
}
dependencies {
def lifecycle_version = "2.4.0"
def room_version = "2.3.0"
kotlin {
experimental {
coroutines "enable"
}
}
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Annotation processor
implementation("androidx.room:room-runtime:$room_version")
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
//coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
}
Subscriber
package com.homeofficeprojects.samplearchitecturedatabasecoroutinesproject
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
#Entity(tableName = "subscriber_data_table")
data class Subscriber(
#PrimaryKey(autoGenerate = true)
#ColumnInfo(name = "subscriber_id")
var id: Int,
#ColumnInfo(name = "subscriber_name")
var name: String,
#ColumnInfo(name = "subscriber_email")
var email: String
) {
//constructor(): this(0, "", "")
}
Edit: I've added the Gradle Build file and Subscriber
kotlin class
Edit 2: Second picture, more info on the errors
I ended up asking on reddit and was told to roll back the gradle dependency.
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
from
ext.kotlin_version = "1.6.0"
to
ext.kotlin_version = "1.5.31"
I'm not sure I would call that a way forward, but I can move on with my project so I'm calling it one until an actual answer comes through
I have watched and read many tutorial on How to use Room persistence library with coroutines but whenever I use coroutine in my file it forces me to annotate my code with #InternalCoroutineApi but in the tutorial they don't need to annotate anything.
Now I'm wanted to know
1. What does this annotation means?
2. Why it is necessary?
3. How can I avoid this?
Even this answer doesn't help me either.
below is the how I created my data base and my build.gradle file
import android.content.Context
import androidx.room.Database
import androidx.room.Entity
import androidx.room.Room
import androidx.room.RoomDatabase
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.internal.synchronized
#Database(entities = [Post::class], version = 1, exportSchema = false)
public abstract class PostRoomDatabase: RoomDatabase() {
abstract fun getDao(): PostDao
companion object{
//Companion object provide the same functionality as the Static keyword in java
#Volatile
private var DATABASE_INSTANCE :PostRoomDatabase? = null
#InternalCoroutinesApi
fun getDatabase(context: Context) : PostRoomDatabase{
val tempInstance = DATABASE_INSTANCE
if(tempInstance != null){
return tempInstance
}
synchronized(this){
val instance = Room.databaseBuilder(
context.applicationContext,
PostRoomDatabase::class.java,
"post_database"
).build()
DATABASE_INSTANCE = instance;
return instance
}
}
}
}
Build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "vijay.bhadolia.seed"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
def room_version = "2.2.5"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Circular images
implementation 'de.hdodenhof:circleimageview:3.1.0'
//Room database
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
def coroutines_version = "1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
}
Your imports say:
import kotlinx.coroutines.internal.synchronized
Which is the internal API that it is complaining about. You should not be importing anything for the synchronized keyword, so simply remove that import line.
ApiModule.kt
#Module
class ApiModule {
private val BASE_URL = "https://raw.githubusercontent.com"
#Provides
fun providesCountriesApi() : CountriesApi{
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
.create(CountriesApi::class.java)
}
#Provides
fun provideCountriesService(): CountriesService {
return CountriesService()
}
}
ApiComponent.kt
#Component(modules = [ApiModule::class])
interface ApiComponent {
fun inject(service: CountriesService)
fun inject(viewModel: ListViewModel)
}
CountriesService.kt
class CountriesService {
#Inject
lateinit var api: CountriesApi
init {
DaggerApiComponent.create().inject(this)
}
fun getCountries(): Single<List<Country>> {
return api.getCountries()
}
}
CountriesApi.kt
interface CountriesApi {
#GET("DevTides/countries/master/countriesV2.json")
fun getCountries(): Single<List<Country>>
}
gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.demo.kotlinandroidmaster"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'info.androidramp:loading-gear:1.0.4'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.dagger:dagger:2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation "androidx.room:room-runtime:2.0.0-rc01"
implementation "androidx.room:room-rxjava2:2.0.0-rc01"
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0-rc01"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0-rc01"
annotationProcessor "androidx.room:room-compiler:2.0.0-rc01"
annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Dagger component is not getting generated
try doing a build of your project, before running the app.
Dagger components are generated when a Build is done and removed when a Clean is done.
Edit
#Singleton
#Component(
modules = [AppModule::class, AndroidInjectionModule::class,
InjectionBinder::class,
AndroidSupportInjectionModule::class, InjectionBinder::class]
)
interface AppComponent {
#Component.Builder
interface Builder {
#BindsInstance
fun application(app: YourApplication): Builder
fun build(): AppComponent
}
fun inject(app: YourApplication)
}
here's a working example of an AppComponent
You are missing the annotation processor and the dagger compiler dependency.
In your build.gradle add after the other plugins:
apply plugin: 'kotlin-kapt'
and then, as dependency:
kapt 'com.google.dagger:dagger-compiler:2.21'
Side note: you are not using the latest version of Dagger.
I am trying to implement Room into Android application written in Kotlin. After build failing so many times, I pinpointed the problem that it failed when I added #Database into my database class.
package sample.service.local
import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import sample.service.model.Announcement
#Database(entities = [Announcement::class], version = 1)
abstract class AnnounceDatabase: RoomDatabase() {
abstract fun announceDAO(): AnnounceDAO
}
If I commented out the line with #Database it built successfully. Its DAO and Entity files shouldn't be the problem as I tried building with them without #Database and it was successful. I also haven't added them into any other classes; I just created 3 new files which are this database, its dao, and its entity.
Here's build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
compileSdkVersion 27
defaultConfig {
applicationId "sample"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
dataBinding.enabled true
}
}
project.ext {
supportLibraryVersion = "26.1.0"
daggerVersion = "2.13"
butterKnifeVersion = "8.8.1"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1"
lifecycleVersion = "1.0.0"
roomVersion = "1.0.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.android.support:support-v4:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Android Support Library
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:support-core-ui:27.1.0'
// Easy Permission
implementation 'pub.devrel:easypermissions:1.2.0'
// Lifecycle
implementation "android.arch.lifecycle:extensions:1.1.0"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
// Kotlin binding
// kapt 'com.android.databinding:compiler:3.1.0'
// Dagger core
kapt "com.google.dagger:dagger-compiler:$project.daggerVersion"
implementation "com.google.dagger:dagger:$project.daggerVersion"
// Dagger Android
kapt "com.google.dagger:dagger-android-processor:$project.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$project.daggerVersion"
// Timber
implementation 'com.jakewharton.timber:timber:4.6.0'
// Simple Item Decoration
implementation 'com.bignerdranch.android:simple-item-decoration:1.0.0'
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.1.0"
implementation "com.squareup.retrofit2:converter-gson:2.1.0"
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
// RxJava & RxAndroid
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
// PageIndicatorView
implementation 'com.romandanylyk:pageindicatorview:1.0.0#aar'
// Room
implementation "android.arch.persistence.room:rxjava2:$project.roomVersion"
implementation "android.arch.persistence.room:runtime:$project.roomVersion"
kapt "android.arch.persistence.room:compiler:$project.roomVersion"
testImplementation "android.arch.persistence.room:testing:$project.roomVersion"
}
Here's project's gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I ran gradlew clean build --stacktrace --debug and here's error message
Any help will be appreciated.
The problem is in my Entity class where I used val instead of var for the parameters, so I just changed all of them to var and the problem is solved.
Edit: My DAO class also has a problem as well where ArrayList cannot be used instead of List