How to create masterKey after MasterKeys deprecated in Android

try this one MasterKey masterKey = new MasterKey.Builder(context, MasterKey.DEFAULT_MASTER_KEY_ALIAS) .setKeyScheme(MasterKey.KeyScheme.AES256_GCM) .build(); SharedPreferences sharedPreferences = EncryptedSharedPreferences.create( context, SHARED_PREF_NAME, masterKey, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM);

Error compiling in IntelliJ IDEA: “No MessageCollector”

Promoting the answer in the comments to an answer, because it’s the actual answer: This appears to be a bug in the IntelliJ Kotlin plugin v1.2.40 and how it interacts with Java 10. See here. The solution is to upgrade to v1.2.41. (Don’t switch your project to building with Gradle like the other answer suggests … Read more

Is it possible to specify a static function in a Kotlin interface?

Basically, nothing in a companion object can be abstract or open (and thus be overridden), and there’s no way to require the implementations’ companion objects to have a method or to define/require a constructor in an interface. A possible solution for you is to separate these two functions into two interfaces: interface Serializable<ToType> { fun … Read more