1) add a dependency to the build.radio.exe file of the application
compile 'com.android.support:multidex:1.0.2'
2) If you do not override the application class, edit the manifest file to set the android: name name in the tag as follows:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapp"> <application android:name="android.support.multidex.MultiDexApplication" > ... </application> </manifest>
If you override the Application class, modify it to extend MultiDexApplication (if possible) as follows:
public class MyApplication extends MultiDexApplication { ... }
Or, if you override the application class but cannot change the base class, you can instead override the attachBaseContext () method and call MultiDex.install (this) to enable multidex:
public class MyApplication extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }
3) Add multidex support to defaultConfig in build.gradle
defaultConfig { ... minSdkVersion 16 targetSdkVersion 26 ... // Enabling multidex support. multiDexEnabled true } ...
georgehardcore Jun 05 '15 at 7:30 2015-06-05 07:30
source share