
keno.basedow
Kotlin and Android Development featuring Jetpack: Cannot find identifier 'basicAI' (version B4.0 page 78)
Hello Michael,
i have problems with this line on page 78 in version B4.0:
android:entries=“@{AI.basicAI}”
it shows the error message:
Cannot find identifier ‘basicAI’
I solved the problem changing the line to:
android:entries=“@{AI.getBasicAI()}”
I found the solution on the internet page in the answer of [dominicoder]:
I used Tools > Kotlin > Show Kotlin Bytecode > Decompile to take a look how java has encoded the property.
Am i on the right path? Or do i have any other kind of problem?
I am using Android Studio 4.1.1 and these library versions:
kotlin_version = “1.4.21”
gradle_version = “4.1.1”
app_compat_version = “1.2.0”
constraint_layout_version = “2.0.4”
core_version = “1.3.2”
lc_version = “2.2.0”
nav_version = “2.3.2”
Best regards
Keno Basedow
Marked As Solved

mfazio23
Hey Keno!
You’re definitely on the right path here, but the error in Android Studio about not being able to find AI.basicAI
is incorrectly flagged. That being said, I like using AI.getBasicAI()
to avoid this kind of confusion.
Looking at the Java code is the right approach as Kotlin properties are converted in the fashion you saw. This means properties of a Kotlin class are accessed on the Java side by get()/set()
methods.
I’m going to switch up the code and include a little note explaining the difference here. Thanks!
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
- /ash
- /centos
- /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