I have converted my application into MultiDex to bear with 64k dex limit. Now it looks like this:
public class App extends MultiDexApplication {
private App
If anyone gets here because their Application class is not being found on pre-Lollipop devices, but the app runs fine on Lollipop and above then this appears to be a known issue with Jack and Multidex.
Ref: Jack Issue 213484
Ref: Jack Issue 224026
I've finally solved it! Cause was not in the onCreate()
method. There was this line from logcat that gained my attention:
I/dalvikvm﹕ Failed resolving Lcom/playday/app/core/AppWrapper; interface 8940 'Lretrofit/ErrorHandler;'
W/dalvikvm﹕ Link of class 'Lcom/playday/app/core/AppWrapper;' failed
This line fired before all the MultiDex log. Source of the problem was Retrofit ErrorHandler
interface, which AppWrapper
implements.
As @AlexLipov said in his answer, Dalvik just couldn't find ErrorHandler
class and failed to load AppWrapper
.
Anyway, solution is not to implement ErrorHandler
directly by AppWrapper
and pull it into private variable instead.