Group Group Group Group Group Group Group Group Group

Chapter 16 P 305: Cannot Resolve Symbol arg0

#1

The book states:
// 3
@Query(“SELECT * FROM Bookmark WHERE id = :arg0”)
fun loadBookmark(bookmarkId: Long): Bookmark
@Query(“SELECT * FROM Bookmark WHERE id = :arg0”)
fun loadLiveBookmark(bookmarkId: Long): LiveData

In Android Studio 3.3 this produces the error ‘Cannot resolve symbol arg0’.
P 307 states “Note: A bug in the current Kotlin implementation requires the use of the :arg# syntax. Once this bug is fixed, you’ll be able to use the actual names of the method arguments.”

I replaced with the code below, and the error disappeared, but grateful for confirmation :
@Query(“SELECT * FROM Bookmark WHERE id = :bookmarkId”)
fun loadBookmark(bookmarkId: Long): Bookmark

#2

@tblank Do you have any feedback about this? Thank you - much appreciated! :]

#3

Hi @mazen_kilani,

Thank you again for the report!

As you have discovered, the bug that was present when the book was written has now been fixed. I can confirm that your update to replace :arg0 with :bookmarkId is the proper fix and will be reflected in the next version of the book.

Thanks,
Tom