Kotlin and Android Development featuring Jetpack: apply plugin vs plugins {...} (page 37)

Google strikes again… In ArcticFox 2020.3.1 patch 2 (Gradle 8.0), it looks like they changed Gradle’s syntax yet again in a way guaranteed to break every project that ever came before it.

Old version (printed in book):

apply plugin 'com.android application'
apply plugin 'kotlin-android'
apply plugin 'kotlin-kapt'

Revised version (based on syntax in ArcticFox build.gradle):

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
}

Jeff,
You’re correct that the second version is the current way to write out plugins, but the old version should still work.
Also, a heads up that the version you posted has a few issues. You’re missing colons after plugin and the first plugin is missing a dot after android:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

Let me know if that works!

(blush) whoops, the lack of colon after plugin: and missing dot would definitely explain why my experiment to see whether the two syntaxes could coexist side by side failed. You’re 100% right, both syntaxes can exist side by side in the same build.gradle file.

All good! And you do have the currently correct syntax in your first post, I may want to switch things over to avoid any confusion.