Aspose.Words for Android works great in a tiny sample code that you provide. However, as soon as I added the Aspose.Words.1.9.0.jdk16.jar to my Android app project, which uses also several other 3rd party jar libraries, I get an error when trying to compile it:
Error:Android Dex: [] Unable to execute DX
Error:Android Dex: [] java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536
…
This means that the total number of methods in the project exceeds the maximum allowed (65536), you jar file is so huge. What is the recommended work-around for it?
I was able to compile the project using DexGuard (paid version of ProGuard), which cuts out unused classes, methods and fields from the Java code and JAR libraries, but the compilation time for my project with this increased from 2 minutes to over 30 minutes when Aspose.Words jar is included. And it’s tricky using Dex/Pro/Guard in that way, as it’s not aware of e.g. fields and methods accessed with Java reflection, so it’s an endless cycle of compiling, testing if the code works or not, editing dexguard-project.txt file to prevent removing what’s needed, compile (over 30 minutes) and test again… Nightmare.
Any better ideas on how to deal with this issue?
Greg
Just counted the number of methods in Aspose.Words.1.9.0.jdk16.jar:
47945 methods!!!given that the maximum for an Android DEX file is 65536, this makes it VERY IMPRACTICAL to use Aspose.Words for Android in any bigger project… Guess I won’t be buying your license.
Here is the method I used to count them:
Gregdx –dex –output=temp.dex orig.jar
cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 “%d\n”'
Hi Greg,
When is soon?
I have purchased Aspose Total for Android but am unable to include both the Cells and Words libraries in the same project.
Hi Greg,
This issue was raised in June, it is now September and there have been new releases of both Words and Cells with no fix to this issue.
Will it be fixed?
Hi
Will Aspose.Cells also be reduced?
Hi Daniel,gspllc:Will Aspose.Cells also be reduced?
Thanks for using Aspose for Android.
We have also logged this request (Reduce the size of Aspose.Cells for Android) in our database.
We will investigate it and fix this issue. Once, there is some fix or other news for you, we will let you know asap.
This issue has been logged as
- CELLSANDROID-46 - Reduce the size of Aspose.Cells for Android
Hi,
Thanks for using Aspose.Cells for Android.
Please add “aspose-cells-8.4.1.1.jar” (attached) to your project lib and put “aspose-cells-8.4.1.1-libs.apk” into the folder “assets”. There are two methods to load “aspose-cells-8.4.1.1-libs.apk” on start:
1. Load it in your custom Application class:
If you don’t have a custom Application class, register one in your AndroidManifest.xml :
2. Load it in MainActivity.OnCreate:
All Images: