2Answers
  • 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Cannot resolve symbol RoomDatabase

I want to try out Room Persistence library, but after adding and downloading it with gradle, I can find most classes, except:

import android.arch.persistence.room.Database;
import android.arch.persistence.room.RoomDatabase;

import com.doors.geopoly.dal.entities.User;

@Database(entities = {User.class}, version = 1)

public abstract class GeoDatabase extends RoomDatabase {
    public abstract UserDao userDao();
}

Every room library class is present, except RoomDatabase will be red in the IDE stating that it can't resolve that symbol.

Why?

Here's my gradle config:

project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"

        implementation "android.arch.persistence.room:runtime:1.1.1"
        annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    }
}

It seems that you separated layers like Clean Architecture.

if we suppose that you use a separated module for wrapping all of db transactions and so on that named db_module

You should note that Room is an Android Library that are lifecycleAware and depend on Android platform, so you must define your db_module - that contain Room - as an Android library.

so it's just using

apply plugin: "com.android.library"

instead of

apply plugin: "java"

this changes your java module to a android module that contain Android OS properties.

  • 1
Reply Report