如何在Android Studio 4.1中默认启用Kotlin Android扩展 [英] How to Enable Kotlin Android Extensions by Default in Android Studio 4.1
问题描述
为什么在最新版本的Android Studio中默认未启用kotlin-android-extensions?实际上,只要我知道,我就必须在gradle文件中手动添加插件.有什么解决方法,以便我每次创建新项目时都可以添加插件并自动启用它?谢谢你.
Why kotlin-android-extensions not enabled by default in this latest version of Android Studio? In fact, as long as i know, i have to manually add the plugin in gradle files. Any workaround so that i can add the plugin and enable it automatically everytime i create new project? Thanks before.
ICYMI,这是启用kotlin-android需要添加的代码
ICYMI, this is the code that needs to be added to enable kotlin-android
plugins {
id 'com.android.application'
id 'kotlin-android'
// add kotlin-android-extensions
id 'kotlin-android-extensions'
}
推荐答案
在Kotlin 1.4.20-M2中,JetBrains弃用了Kotlin Android扩展编译器插件.
In Kotlin 1.4.20-M2 JetBrains deprecated Kotlin Android Extensions compiler plugin.
kotlinx.android.synthetic不再是推荐的做法.删除支持显式的findViewById
kotlinx.android.synthetic is no longer a recommended practice. Removing in favour of explicit findViewById
非常不幸的消息:(,我讨厌viewBinding
Very sad news :(, i hate viewBinding
这篇关于如何在Android Studio 4.1中默认启用Kotlin Android扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!