title: Secured Android SharedPreferences Error: 'Caused by: java.lang.RuntimeException: Field keySize_ for...'
body: <p>In an Android Kotlin project, I implemented EncryptedSharedPreference feature based on this <a href="https://developer.android.com/topic/security/data#edit-shared-preferences" rel="noreferrer">link</a> using the <strong><em>androidx.security</em></strong> library and it worked well in debug mode. But in release mode, I keep getting this error</p>
  
  <pre><code>  java.lang.ExceptionInInitializerError
      at com.package_name.i.a.f(:46)
      at com.package_name.i.a.j(:52)
      at com.package_name.i.a.e(:82)
      at com.package_name.MyApplication.onCreate(:37)
      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
      at android.app.ActivityThread.-wrap1(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:148)
      at android.app.ActivityThread.main(ActivityThread.java:5417)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
   Caused by: java.lang.RuntimeException: Field keySize_ for k.a.d.a.h0.u not found. Known fields are [private int k.a.d.a.h0.u.i, private static final k.a.d.a.h0.u k.a.d.a.h0.u.j, private static volatile k.a.d.a.i0.a.a1 k.a.d.a.h0.u.k]
      at k.a.d.a.i0.a.v0.n0(:608)
  </code></pre>
  
  <p>Please kindly share your ideas on how to solve this error. </p>