In the latest version in February 2022 doesn’t need to add buildscript anymore just add the id in build.gradle for project. It will be like this in build.gradle for project:
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'androidx.navigation.safeargs' version '2.4.1' apply false
// classpath are changed, so no need to add classpath anymore just the id and the version
}
Don’t forget add the id again in the build.gradle module,
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs'
}