I'm experiencing a pretty strange thing in Kotlin. I have
var myClipboard = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager?
var myClip: ClipData? = ClipData.newPlainText( /* my code */ )
As a var
variable, I should be able to reassign his value, but when I do
myClipboard?.primaryClip = myClip
It gives me the error
Val cannot be reassigned
The strangest things is that I'm using this code by weeks and it always worked. It stopped working today when I updated to API 29
This is my build.gradle
android{}
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.arfmann.pushnotes"
minSdkVersion 23
targetSdkVersion 29
versionCode 16
versionName "1.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}