硬件信息
phone: Huawei Mate 7(MT7-TL10)
OS: Android 4.4.2
CPU: Kirin925
构建.gradle
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
}
这里我的 minSdkVersion > 14 ,所以它支持multidex
重要日志
I/MultiDex( 4514): VM with version 1.6.0 does not have multidex support
I/MultiDex( 4514): Installing application
I/MultiDex( 4514): MultiDexExtractor(/data/app/pkg_name-1.apk, /data/data/pkg_name/code_cache/secondary-dexes)
I/MultiDex( 4514): Blocking on lock /data/data/pkg_name/code_cache/secondary-dexes/MultiDex.lock
I/MultiDex( 4514): /data/data/pkg_name/code_cache/secondary-dexes/MultiDex.lock locked
I/MultiDex( 4514): MultiDexExtractor.load(/data/app/pkg_name-1.apk, false, )
I/MultiDex( 4514): Detected that extraction must be performed.
I/MultiDex( 4514): Extraction is needed for file /data/data/pkg_name/code_cache/secondary-dexes/pkg_name-1.apk.classes2.zip
I/MultiDex( 4514): Extracting /data/data/pkg_name/code_cache/secondary-dexes/tmp-pkg_name-1.apk.classes1353338101.zip
08-01
I/MultiDex( 4514): Renaming to /data/data/pkg_name/code_cache/secondary-dexes/pkg_name-1.apk.classes2.zip
I/MultiDex( 4514): Extraction succeeded '/data/data//pkg_name/code_cache/secondary-dexes//pkg_name-1.apk.classes2.zip': length 3303095 - crc: 3802116964
I/MultiDex( 4514): Extraction is needed for file /data/data//pkg_name/code_cache/secondary-dexes//pkg_name-1.apk.classes3.zip
I/MultiDex( 4514): Renaming to /data/data/pkg_name/code_cache/secondary-dexes/pkg_name-1.apk.classes3.zip
I/MultiDex( 4514): Extraction succeeded '/data/data/pkg_name/code_cache/secondary-dexes/pkg_name-1.apk.classes3.zip': length 1904964 - crc: 3374652227
I/MultiDex( 4514): load found 2 secondary dex files
W/MultiDex( 4514): Failed to install extracted secondary dex files, retrying with forced extraction
W/MultiDex( 4514): java.io.IOException: unable to open DEX file
W/MultiDex( 4514): at dalvik.system.DexFile.openDexFile(Native Method)
W/MultiDex( 4514): at dalvik.system.DexFile.<init>(DexFile.java:109)
W/MultiDex( 4514): at dalvik.system.DexFile.loadDex(DexFile.java:149)
W/MultiDex( 4514): at android.support.multidex.b$a.a(MultiDex.java:700)
W/MultiDex( 4514): at android.support.multidex.b$a.a(MultiDex.java:660)
W/MultiDex( 4514): at android.support.multidex.b.a(MultiDex.java:349)
W/MultiDex( 4514): at android.support.multidex.b.a(MultiDex.java:263)
W/MultiDex( 4514): at android.support.multidex.b.a(MultiDex.java:112)
W/MultiDex( 4514): at pkg_name.baselib.base.BaseApplication.attachBaseContext(BaseApplication.java:59)
提取 apk 辅助 dexes 成功,但 installSecondaryDexes 失败
我试着
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
try {
MultiDex.install(this);
} catch(Exception e) {
e.printStackTrace();
}
}
但也失败了,非常感谢任何帮助。