Kanat Bayalbayev
Kanat Bayalbayev

Reputation: 1

ERROR: This annotation is not applicable to target 'member function' in Kotlin

@Dao
interface CoinPriceInfoDao {
    @Query("SELECT * FROM full_price_list ORDER BY lastupdate")
    fun getPriceList(): LiveData<List<CoinPriceInfo>

    @Query("SELECT * FROM full_price_list WHERE fromsymbol == :fSym LIMIT 1")
    fun getPriceInfoAboutCoin(fSym: String): LiveData<CoinPriceInfo>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertPriceList(priceList: List<CoinPriceInfo>)
}

I have an error for the first two Queries What should I do?

screenshot

Upvotes: 0

Views: 362

Answers (1)

Hekmatullah Amin
Hekmatullah Amin

Reputation: 1

The error you're encountering likely stems from using the wrong @Query annotation. Your code snippet defines queries for a Room database, so you should be using import androidx.room.Query instead of import retrofit2.http.Query.

Upvotes: -1

Related Questions