title: ProGuard for Kotlin: JVM signature cannot be resolved
body: <p>When activating ProGuard, I get the following error message that seems to stem from Kotlin Reflect.</p>
  
  <pre><code>kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Property 'selectedAccount' (JVM signature: getSelectedAccount()Lmy/app/package/data/model/Account;) not resolved in class my.app.package.data.SharedPrefsData
      at kotlin.reflect.jvm.internal.KDeclarationContainerImpl.findPropertyDescriptor(:115)
      at kotlin.reflect.jvm.internal.KPropertyImpl$_descriptor$1.invoke(:102)
      at kotlin.reflect.jvm.internal.KPropertyImpl$_descriptor$1.invoke(:27)
      at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(:92)
      at kotlin.reflect.jvm.internal.KPropertyImpl.getDescriptor(:105)
      at kotlin.reflect.jvm.internal.KPropertyImpl$_javaField$1.invoke(:52)
      at kotlin.reflect.jvm.internal.KPropertyImpl$_javaField$1.invoke(:27)
      at kotlin.reflect.jvm.internal.ReflectProperties$LazyVal.invoke(:62)
      at kotlin.reflect.jvm.internal.KPropertyImpl.getJavaField(:79)
      at kotlin.reflect.jvm.ReflectJvmMapping.getJavaField(:40)
      at kotlin.reflect.jvm.KCallablesJvm.a(:65)
      at com.chibatching.kotpref.livedata.KotprefLiveDataExtensionsKt$a.&lt;init&gt;(:16)
      at com.chibatching.kotpref.livedata.KotprefLiveDataExtensionsKt.a(:11)
      at my.app.package.data.SharedPrefsData.getSelectedAccountLiveData(:20)
  </code></pre>
  
  <p><code>SharedPrefsData</code> is a simple <a href="https://github.com/chibatching/Kotpref" rel="nofollow noreferrer">KotprefModel</a> to store and load from SharedPreferences:</p>
  
  <pre><code>class SharedPrefsData(context: Context) : KotprefModel(context), ISharedPrefsData {
  
      override val kotprefName: String = "${context.packageName}_preferences_data"
  
      override var selectedAccount by gsonNullablePref&lt;Account&gt;()
  
      override fun getSelectedAccountLiveData(): LiveData&lt;Account?&gt; {
          return asLiveData(this::selectedAccount)
      }
  }
  </code></pre>
  
  <p>And this is what happens in <code>KotprefLiveDataExtensionsKt</code></p>
  
  <pre><code>fun &lt;T&gt; KotprefModel.asLiveData(property: KProperty0&lt;T&gt;): LiveData&lt;T&gt; {
      return object : LiveData&lt;T&gt;(), SharedPreferences.OnSharedPreferenceChangeListener {
          private val key: String
  
          init {
              value = property.get()
              property.isAccessible = true
              key = (property.getDelegate() as? PreferenceKey)?.key ?: property.name
              property.isAccessible = false
          }
  
          override fun onSharedPreferenceChanged(prefs: SharedPreferences, propertyName: String) {
              if (propertyName == key) {
                  postValue(property.get())
              }
          }
  
          override fun onActive() {
              this@asLiveData.preferences.registerOnSharedPreferenceChangeListener(this)
          }
  
          override fun onInactive() {
              this@asLiveData.preferences.unregisterOnSharedPreferenceChangeListener(this)
          }
      }
  }
  </code></pre>
  
  <p>So there seems to be some Kotlin Reflection going on which is famous to cause problems with ProGuard.
  But I am already keeping the involved model classes as well as the SharedPrefsData classes. The only ProGuard rules I can find on the <a href="https://github.com/chibatching/Kotpref/blob/master/kotpref/proguard-rules.pro" rel="nofollow noreferrer">KotPref Github</a> are already applied here.</p>
  
  <p>Right now I am using the following ProGuard rules:</p>
  
  <pre><code>-keep class kotlin.reflect.jvm.internal.** { *; }
  -keep class kotlin.reflect.jvm.ReflectJvmMapping { *; }
  -keep class com.chibatching.kotpref.livedata.KotprefLiveDataExtensionsKt
  -keep class kotlin.reflect.jvm.KCallablesJvm  
  -keep class my.app.package.data.model.Account { *; }
  -keep class my.app.package.data.model.User { *; }
  -keep class my.app.package.data.model.Team { *; }
  -keep class my.app.package.data.SharedPrefsData { *; }
  -keep class my.app.package.data.ISharedPrefsData { *; }
  </code></pre>
  
  <p>But the error is still there. Any idea what to do here??</p>