I just hit a weird thing: our app would crash with...
# android
w
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?
z
I am pretty sure I filed a bug to Google with this exact issue
It was extremely frustrating to have release builds crash (with r8) and debug builds work just fine
w
@Zach Kovar I had a feeling it might be a bug in R8 (it shouldn’t really make the app crash) but thought maybe someone has more insight into this.
https://issuetracker.google.com/issues/139939453 nice. Exactly the same case, closed because someone didn’t answer bunch of irrelevant questions smh
🤦‍♂️ 1
t
Well it's opened in the wrong place 😉 Open R8 issues at https://issuetracker.google.com/issues?q=componentid:326788%20status:open they are reactive, efficient and nice 🙂
z
Come to look back at it - I can't find the issue I thought I filed, so maybe I didn't 😅 I just renamed the method to something other than
clear()
which is kind of a blah fix, but at least it was a work-around
w
@Tolriq thanks for the hint, I noticed that too and already reopened it at https://issuetracker.google.com/issues/148429150