Yes, finally I find the problem and solve it. I viewed a similar problem here and find that maybe the 64K Methods could cause the problem, so I came to official siteto view Building Apps with Over 64K Methods. Now you should compile the multidex library in your build.gradle file:
compile 'com.android.support:multidex:1.0.1'
And don't forget to config your defaultConfig:
android {
defaultConfig {
multiDexEnabled true
}
}
And finally you can write a BaseApplication extends to Application, over write the attachBaseContext(Context base) method as follows:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Don't forget to add this to your AndroidManifest.xml file:
<application
android:name=".BaseApplication"
android:allowBackup="true">
</application>