如果您的项目需要Application子类,请使用此选项。
Application使用标签android:name内清单文件中的属性指定此子类application。
在Application子类中,添加attachBaseContext()方法重写,并在该方法调用中:MultiDex.install()
package com.example;
import android.app.Application;
import android.content.Context;
/**
 * Extended application that support multidex 
 */
public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}确保Application在applicationAndroidManifest.xml的标记中指定了子类:
<application android:name="com.example.MyApplication" android:icon="@drawable/ic_launcher" android:label="@string/app_name"> </application>