[英]New Android 12+ MaterialSwitch and androidx.preference
[英]Unresolved reference importing kotlinx.android and androidx.preference?
好的,所以我确定我以前从来不需要向 build.gradle 添加任何内容,猜测它是自动完成的,并且不知何故我已经关闭了该功能?但显然我现在要解决这个问题......
因此,对于其他坚持这一点的人:
Want … import kotlinx.android.synthetic.main.fragment_button.*
Make sure you include id 'kotlin-android-extensions' in build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
Want … import androidx.preference.PreferenceManager.getDefaultSharedPreferences
Make sure you include “implementation 'androidx.preference:preference:1.1.1'” in build.gradle
dependencies {
implementation 'androidx.preference:preference:1.1.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
…
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.