
dachristenson
Kotlin and Android Development featuring Jetpack: Ch. 9 won't build
I have copied / typed in all the code to the end of Ch. 9, but I cannot get the project to build. It keeps failing with the error:
“e: file:///C:/Users/derek/Dropbox/AndroidStudioProjects/AndroidBaseballLeague/app/src/main/java/com/example/abl/teams/TeamsGridAdapter.kt:43:17 Unresolved reference: setClickListener”
I’ve verified that the code for the TeamViewHolder inner class is identical to the provided code (by copying and pasting it), but it still fails. Android Studio has one suggestion for importing a function, but it then causes even more errors, so I think that may be the wrong function. Besides, that function is not imported in the provided Ch. 9 code.
I squashed a few typos in the Gradle files, but this is still happening, so I’m not sure where my problem is. Has something else changed in Android, or do I just have a typo I cannot find? Do you have any suggestions?
My repository is here: GitHub - dachristenson/Android_Baseball_League: Working through Part II of "Kotlin and Android Development Featuring Jetpack" by Michael Fazio.
Thanks for any help in advance!
Marked As Solved

mfazio23
The setClickListener
function is an extra binding adapter on the ViewBindingAdapter
class, so you would need an additional import there. That being said, I think that signature may have changed as well.
In reality, the better approach here is to use the setOnClickListener { ... }
function on the view’s root:
root.setOnClickListener {
...
}
This is clearer and similar to how you normally handle click listeners in Android.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /centos
- /ash
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /c
- /julia
- /neovim