After updating android target Sdk to 31. Before that it was working fine.
build.gradle
buildscript {
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 28
compileSdkVersion = 31
targetSdkVersion = 31
supportLibVersion = "30.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.0")
}
}
As soon as a USB device is connected following error gets thrown :
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.