INSTALL_FAILED_DEXOPT Error in Android 5.0 in Release mode INSTALL_FAILED_DEXOPT Error in Android 5.0 in Release mode android android

INSTALL_FAILED_DEXOPT Error in Android 5.0 in Release mode


When the APK is installed onto Android, the OS executes dex2opt for optimizing. The INSTALL_FAILED_DEXOPT error message means that your device can't optimize the dex file.

This issue usually occurs because of the dex file size. Usually, you can find a LinearAlloc Limit warning or error message in the Android monitor when this happens. If it is a problem of dex size, add this to your build.gradle file:

afterEvaluate {    tasks.matching {        it.name.startsWith('dex')    }.each { dx ->        if (dx.additionalParameters == null) {            dx.additionalParameters = []        }              // To avoid linearAlloc limit problem on Gingerbread and below         dx.additionalParameters += "--set-max-idx-number=50000"         dx.additionalParameters += "--minimal-main-dex"    }}

Also, be sure to turn Instant Run off.


This issue might occur due to mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.


please see if your app has been by mistake installed in your guest account of your phone.

If yes, then un-install or remove it from there.

Do this for all user accounts in your phone.

Additional tips:-

Build -> Clean project Build -> Rebuild project