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()
-keep class com....SlideshowViewModel {*;}
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?
I have the following in my ViewModel (Kotlin)
val currentItem = MediatorLiveData<MediaItem>()
....later...
Timber.d("Setting next image: " + position + " out of " + mediaItemList.size)
currentItem.value = mediaItemList[position]
and the Activity (Java)
viewModel.getCurrentItem().observe(this, new Observer<MediaItem>() {
@Override
public void onChanged(@Nullable final MediaItem mediaItem) {
Timber.d("Activity received new item");
}
});
In the log I receive: D/SlideshowViewModel: Setting next image: 0 out of 18
But nothing get's fired in the onChanged Observable.