I just hit a weird thing: our app would crash with the following error:
java.lang.LinkageError: Method void com.example.h72.a() overrides final method in class Lcom.example/de; (declaration of 'com.example.h72' appears in base.apk)
.
That’s after obfuscation with R8. The cause was we’d have the following class hierarchy:
androidx.lifecycle.ViewModel <- BaseViewModel <- SomeViewModel
, and in
SomeViewModel
we’d have a
fun clear() { }
method. However, method with same name and signature appears in `androidx.lifecycle.ViewModel.java`:
final void clear()
.
What I quite don’t understand is, why everything works without R8? I clearly see
public final void clear()
method in the decompiled
SomeViewModel
, and so feels like things should crash straight away. What happens instead, app works fine without R8 and only crashes with it. 😕 Any idea what might be the reason?