[Solved] INSTALL_FAILED_DEXOPT (DEX optimization verification failed)

Phenomenon: APK installation of some mobile phones (system 5.0 11 model, system version is uncertain) fails, and the operation code is as follows:

The installation did not succeed.
The application could not be installed: INSTALL_FAILED_DEXOPT (DEX optimization verification failed)

List of apks:
[0]  ‘ D:\workspace\WalletHelper\app\build\outputs\apk\debug\app-debug.apk’
The device might have stale dexed jars that don’t match the current version (dexopt error).

Let’s start with the solution:

Put < in androidmanifest.xml; application> Set the Android: vmsafemode property of to true

Since minsdkversion 21 is set, Android 5.0 (API level 21) and later versions use the runtime named art, which itself supports loading multiple DEX files from APK files. Art performs precompiling during application installation, which scans for  classesN.dex   Files and compile them into a single file  .oat   File for Android devices to execute. So if your  minSdkVersion   For version 21 or later, multidex is enabled by default, and you do not need the multidex library.

Read More: