We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words for Android: Unable to execute DX

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:
dx dex output=temp.dex orig.jar
cat temp
.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 “%d\n”'
Greg

Hi Greg,


Thanks for your inquiry. We are in communication with our development team and will get back to you soon.

Best regards,
Dear Greg,

Thank you for making notice of our project and taking time to leave the comment on its functionality. We appreciate your feedback and interest.

Please accept our sincere apologies for the inconvenience brought to you by the big size of the library. We realize that at the moment it is a little impractical since Aspose.Words for Android is based on the Aspose.Words for Java and includes all of its features and some 3rd party libraries.

Please, be informed that it's a temporary issue that will be solved soon.
Our major concern now is to reduce the number of methods without loss of functionality.We are constantly working on improving the quality and usability of our library and hopefully will have you back soon as our loyal customer.

Thank you and have a nice day!

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,


Thanks for being patient. Our development team is actively working on this issue (WORDSANDROID-66). Please spare us some time for the investigation and resolution of this issue. If everything goes by plan, we are very hopeful to integrate the fix to this issue in next Aspose.Words for Android release. However, please note that this estimate is not final at the moment; we will inform you via this thread as soon as your issue is resolved. We apologize for your inconvenience.

Best regards,

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


Since 1.11 we divided the release jar to Aspose.Words.jdk15.jar and Aspose.Words.Libs.jdk15.apk.

On this step Aspose.Words.jdk15.jar has about 33k against 50k in previous releases. We used the approach described here .
In the future we are going to reduce Aspose.Words.jdk15.jar to 6-7k methods.

Please have a look here for more information.

Thanks

Will Aspose.Cells also be reduced?

Yes, AC team is working on it.
gspllc:
Will Aspose.Cells also be reduced?
Hi Daniel,

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: