
nicoatridge
Kotlin and Android Development: Could not get unknown property ‘kotlin_version’…
Hi, I have just acquired Michael Fazio’s “Kotlin and Android Development” to learn about game programming for Android. I have a game in python, js, and - in a basic, command line form - in kotlin and want to port it to Android (web version at https://basilisk.net
). Anyway, got to page 8 and was editting the build.graddle file and found that the line
implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version”
threw up an error “Could not get unknown property ‘kotlin_version’…”
the line jvmTarget = ‘1.8’ was already in the build.graddle file but the dependencies identified were not. Editting out the problematic kotlin_version line and the program runs fine, but I don’t want to waste my time if this is something that causes more problems downstream.
I am on Arctic Fox 2020.3.1 Patch 1.
Marked As Solved

mfazio23
Hey Nic! This is a known issue when using newer versions of Android Studio. They used to add the $kotlin_version
variable for you when creating a new project, but no longer.
If you open the project’s build.gradle
file (not the app’s file of the same name), you can add an ext
block to the buildscript
block to include that variable:
buildscript {
ext {
kotlin_version = '1.4.10'
gradle_version = '4.1.0'
}
// The rest of the buildscript lives down here.
}
Let me know if this helps!
Popular Prag Prog topics









Modern Front-End Development for Rails - application does not start after run bin/setup (page xviii)

Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /js
- /swift
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /flutter
- /c-plus-plus
- /preact
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /vuejs
- /nim
- /emacs
- /nerves
- /elm