Today, when packing, found 2.3 machines, the resulting apk on some machines can not be installed (Installation error: install_failed_dexopt), a possible explanation for this problem is: The latest ADT and SDK The tool may merge the code of the class when it turns the jar into Dex, which will result in a huge class, each method in the class is assigned an ID, and the method is identified and called by ID in the bytecode, and the early Dalvik VM uses the short type variable to identify the ID of the method. The maximum value is limited to 65535, and the code is not validated during installation, so the installation fails.
Our project because of the introduction of too many open-source libraries in the code, so the number of methods too many, and finally can only streamline the code, delete the unnecessary library to solve the problem.
The latest Android has solved this problem, but the earlier version of Android may still exist.
Therefore, due to the existence of a large number of legacy machines, this problem is not completely solved, a temporary solution is: Delete the code is not actually used, or use Proguard processing code (can reduce the code volume).
One unfortunate corollary: with the addition of a software function, the expansion of the code, the APK package will eventually go beyond the scope of processing, perhaps 8M (refers to the APK package inside the Classes.dex).
The two discussion groups that are related to this issue are:
https://code.google.com/p/android/issues/detail?id=40409
Https://groups.google.com/forum/?fromgroups=#!topic/adt-dev/tuLXN9GkVas
At present, the 2.3 version of the market only 20%, I hope this share quickly decline it!
Android Contemporary code method more than 65,536, on the 2.3 machine will not be installed, there is install_failed_dexopt error