Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

android - import needed to implement class remains greyed-out at top of file - not usable

I am trying to import the package needed to use this class : databaseBuilder. The IDE correctly knows that I want to import this ; and offers the autoimport option - but it always stays greyed out at the top - unusable. The databaseBuilder in the code sits there in red - continually offering to import the same package.

I have tried invalidate cahce/restart to no avail.

Minimum code:

package com.lbaron.flyingweather
import androidx.room.Room.databaseBuilder
import androidx.room.RoomDatabase

abstract class TestClass : RoomDatabase(){
    val instance = MetarDBItem.databaseBuilder(null, MetarDatabase::class.java,
    "metar_database")
    .build()
}

enter image description here

Thank you very much

question from:https://stackoverflow.com/questions/65851421/import-needed-to-implement-class-remains-greyed-out-at-top-of-file-not-usable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...