title: Android Architecture Components - ViewModel Observable & Proguard
body: <p>I'm having trouble getting the ViewModel component to work with Proguard.  I already had to add the following to prevent a crash due to NoSuchMethodException: init()</p>
  
  <p>-keep class com....SlideshowViewModel {*;}</p>
  
  <p>However, my observers in the activity aren't receiving any data.  This works fine until I enable Proguard, so I know Proguard is the reason, I just don't know why (novice Proguardian here).  What rule do I need to add to make the observables work?</p>
  
  <p>I have the following in my ViewModel (Kotlin)</p>
  
  <pre><code>val currentItem = MediatorLiveData&lt;MediaItem&gt;()
  </code></pre>
  
  <p>....later...</p>
  
  <pre><code>        Timber.d("Setting next image: " + position + " out of " + mediaItemList.size)
          currentItem.value = mediaItemList[position]
  </code></pre>
  
  <p>and the Activity (Java)</p>
  
  <pre><code>    viewModel.getCurrentItem().observe(this, new Observer&lt;MediaItem&gt;() {
          @Override
          public void onChanged(@Nullable final MediaItem mediaItem) {
              Timber.d("Activity received new item");
          }
      });
  </code></pre>
  
  <p>In the log I receive:
  D/SlideshowViewModel: Setting next image: 0 out of 18</p>
  
  <p>But nothing get's fired in the onChanged Observable.</p>