VM has multidex support, MultiDex support library is disabled

我的梦境 提交于 2019-12-01 15:04:33

create a class lets name it App and extend from MultiDexApplication like this:

import android.support.multidex.MultiDexApplication;

public class App extends MultiDexApplication {
    //you can leave this empty or override methods if you like so the thing is that you need to extend from MultiDexApplication
}

in your manifest add App as your application name just like this

<application
        android:name=".App" // <<< this is the important line!
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name">

After adding everything make a clean build and it should work now :).

Override attachBaseContext method in your application class

@Override
protected void attachBaseContext(Context base) {
  super.attachBaseContext(base);
  MultiDex.install(this);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!