a.zampa

a.zampa

Kotlin and Android Development featuring Jetpack: error concerning function getCurrentStandings in BaseballDao.java

@mfazio23

I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the BaseballDao.java class produced during the build process. I get the following errors:

  • Not sure how to convert a Cursor to this method’s return type (java.lang.Object).
  • Query method parameters should either be a type that can be converted into a database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
  • Unused parameter: continuation
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle insert method’s return type.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle insert method’s return type.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle update method’s return type. Currently the supported return types are void, int or Int.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle update method’s return type. Currently the supported return types are void, int or Int.
  • The query returns some columns [teamId, division, wins, losses, winsLastTen, streakCount, streakType, divisionGamesBack, leagueGamesBack, id] which are not used by java.lang.Object. You can use @ColumnInfo annotation on the fields to specify the mapping. You can annotate the method with @RewriteQueriesToDropUnusedColumns to direct Room to rewrite your query to avoid fetching unused columns. You can suppress this warning by annotating the method with @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH). Columns returned by the query: teamId, division, wins, losses, winsLastTen, streakCount, streakType, divisionGamesBack, leagueGamesBack, id.

The error message is

C:\Users\ale\AndroidStudioProjects\AndroidBaseballLeague\app\build\tmp\kapt3\stubs\debug\org\mathverse\androidbaseballleague\data\BaseballDao.java:31: error: Not sure how to convert a Cursor to this method’s return type (java.lang.Object).
public abstract java.lang.Object getCurrentStandings(@org.jetbrains.annotations.NotNull()

(I’m using org.mathverse.androidbaseballleague as package name, instead of dev.mfazio.abl).

The BaseballDao.java class contains the following lines

@org.jetbrains.annotations.Nullable()
@androidx.room.Query(value = "SELECT * FROM standings")
public abstract java.lang.Object getCurrentStandings(@org.jetbrains.annotations.NotNull()
kotlin.coroutines.Continuation<? super java.util.List<org.mathverse.androidbaseballleague.standings.TeamStanding>> continuation);

This is the only function of the database having prblems.
How can I solve this issue?
Thanks

1 3309 6

Marked As Solved

a.zampa

a.zampa

Michael,

according to comment #11 to issue number 236612358, this problem is related to a change to Kotlin @Metadata annotation and can be solved forcing the dependency to the new version of kotlinx-metadata-jvm by adding

kapt “org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.5.0”

This worked for me and solved another issue (room 2.4.2 didn’t allow to use vals into @Entity data classes asking, for the generated java class, setters for the corresponding variables).

Popular Prag Prog topics Top

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
14 2911 7
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
5 3521 1
New
telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
5 2072 1
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=&gt; (create-...
5 1082 2
New
mikecargal
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
9 2011 5
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
0 1284 2
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
1 1010 4
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
1 3021 5
New
davetron5000
Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
3 1145 19
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
0 1027 10
New

Other popular topics Top

PragmaticStudio
Let’s get real. As in really knowing—clearly and practically—what’s up with Phoenix LiveView. What is it? How does it work? What can I ...
44 2669 11
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
88 5051 33
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
105 13994 48
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
21 10826 8
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
37 2483 15
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
13 3704 5
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
49 4145 15
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
15 4338 2
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
16 3805 12
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
13 2398 10
New

Latest in PragProg

View all threads ❯