MultiDex NoClassDefFound error

后端 未结 8 839
醉梦人生
醉梦人生 2020-11-29 05:52

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         


        
8条回答
  •  借酒劲吻你
    2020-11-29 06:44

    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.

提交回复
热议问题