Issue
I have a problem in Espresso. I must compare a text with an excel cell. Studio says the following when I call apache poi methods.
Error:The number of method references in a .dex file cannot exceed 64K.
I've tried this in my other project and it works well. I've tried to enable multiDex but it gives some other errors because we are using async http master to get movies,music and other content I can't change main project files. There are so much methods, classes and layouts.
Consequently my Question is: is There any way to solve .dex file cannot exceed 64K Error.
Solution
Currently Apache POI will not fully work on your Android Phone out of the box due to various problems that you will run into when using the libraries from Apache POI directly. Android is more strict about duplicate classes as part of the jar-files and unfortunately XmlBeans has such duplicate classes in it's official jar-file. You also need so-called "multi-dex" to overcome the 64k limit encountered by you.
There are two projects that try to make it possible to use Apache POI on Android:
- https://github.com/andruhon/android5xlsx (for Android 5) and https://github.com/andruhon/AndroidReadXLSX (for Android 4), both are currently still based on Apache POI 3.12
- https://github.com/centic9/poi-on-android/ (for Android 5, maintained by me), which can be more easily recompiled with newer versions of POI, e.g. it uses 3.16-beta2 currently
If you really cannot use multi-dex, you will need to strip down Apache POI source code to be below the 64k limit again and then build the jars yourself, however that is probably quite some effort.
Answered By - centic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.