April 2019


325 time



I wanted to simplify the usage of DB in an Android app.

For this, I've compared some third party libraries that create a DAO layer.

I've come up with a nice library called "GreenDao" (presentation about it here) . The website shows that it's faster than other competitors (like ORMLite) and is optimized for Android.

The problem

For some reason, on some device (usually old devices, with GB) , I get the next console error when trying to install the app:

Installation error: INSTALL_FAILED_DEXOPT
Please check logcat output for more details.
Launch canceled!

I've searched for the reason of this error, but couldn't find out how to solve it. Many complain about this error, but I can't find out why it occurs, and what can be done.

The error is quite common and known, but it's never mentioned as the result of using this library, yet when I remove the usage of this library, everything works fine...

Also note that on newer devices (like nexus 4) it installs and works just fine, and that the sample itself also works fine no matter which device I test it on.

The question

Why does it occur?

Is it possible that the structure of the classes is just too much for old devices to load, since we use other libraries ?

Could it be that I've reached the limit of code that is supported by android apps?

The jar file itself takes just 87KB ...

How can I solve this?

1 answers


Ok, I've found the problem and the solution:

It has nothing to do with GreenDao.

It's because the app uses too many jars, so maybe Android has a limitation of code.

The solution is to either delete un-needed jar files or delete a lot of code.