Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while installing application (INSTALL_FAILED_DEXOPT)

I am working with ccr4j API in Android so when I run my project its thrown an error like:
Error while installing application (INSTALL_FAILED_DEXOPT)

I find from net and same site also, did all trying like,
1. Uninstalled same application from device.
2. Run Emulator with Wipe User Data.
But still same error comes.

So anyone know why its thrown this kind of error?

like image 626
PrashantAdesara Avatar asked Feb 16 '13 05:02

PrashantAdesara


2 Answers

This most likely has to do with the size of classes.dex. On anything pre-ICS dexopt will fail on anything over 5mb. Check the size of classes.dex in your apk. It would also be good to see what your method count is as dex has a 65536 method/field limit.

like image 112
Jared Rummler Avatar answered Nov 01 '22 12:11

Jared Rummler


I have same problem. Checked classes.dex file and it is about 7mb's. I'll try to find a solution. I hope Facebook's solution solves mine too.
By the way thanks for information @Jared.
https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920

Edit 1: I've solved this problem by using proguard optimization. My previous classes.dex file was about 7mb, and after proguard optimization it became 4mb. And now I can run this obfuscated and optimized apk on 2.2 and 2.3 devices.

Edit 2: Official Google Multi Dex support is the best solution for this issue. https://developer.android.com/tools/building/multidex.html

like image 31
Devrim Avatar answered Nov 01 '22 13:11

Devrim