本人在之前的项目中合并代码,5.0以上机型可以正常运行,5.0一下机型不能运行 总是提示 dalvikVM could not find methodXXXXXX
经验证主要是方法数超过65K的问题,由于5.0机型直接在gradle中配置 multiDexEnabled true 即可解决 方法数问题。但是5.0一下机型必须导入com.android.support:multidex:1.0.0包才能解决
defaultConfig { minSdkVersion 14 targetSdkVersion 19 multiDexEnabled true }
方法1:需要用自己的application 则复写此方法可解决
- protected void attachBaseContext(Context base)
- {
- super.attachBaseContext(base);
- MultiDex.install(this);
- }
方法2:直接继承MultiDexApplication
方法3:直接在mainfest中指定application为MultiDexApplication