Free Support Forum - aspose.com

Not able to integrate aspose.pdf for android in android studio

I am importing the sample project of aspose.pdf for android in android studio

but it was not gradle supported

so i exported it from eclipse with gradle files

but when i am importing it in android studio it is showing error of output directories


Error:(4, 14) java: error while writing com.example.insertimagedom.BuildConfig: Output directory is not specified.

Hi Tarun,


Thanks for contacting support.

I am trying to replicate the issue in my environment and will keep you posted with my findings. We apologize for this inconvenience.

Let me know the solution of this issue asap. This is the fifth day and I am not able to find any solution.

Hi Tarun,


Thanks for your patience and sorry for the delayed response.

I have been working on replicating the issue while using sample project in my environment however instead of putting you on further hold, we would like to share that recently one of our other customer also faced an issue while using our API in Android Studio. In his scenario, the problem occurred because while compiling, Gradle cannot find classes from the second .dex file (we use approach described here )

There are few ways to solve such problem

1. Stop Gradle from compiling Aspose.Pdf.Android-1.7.jar
2. Second is
a) Add this classes.jar into Gradle as a provided dependency

e.g.
dependencies {
compile files('libs/Aspose.Pdf.Android-1.7.jar)
provided files(‘libs/aw-classes_dex2jar.jar’)
}

You may consider visiting following articles:


Also please confirm that you are getting the error when including Aspose.Pdf for Android in your application or its appearing all the times. If possible, please share your sample project, so that we can test the scenario in our environment. We are sorry for this inconvenience.

I tried the solution you provided. But when I am running the program following error is coming




Installation failed since the device possibly has stale dexed jars that don’t match the current version (dexopt error). In order to proceed, you have to uninstall the existing application. WARNING: Uninstalling will remove the application data! Do you want to uninstall the existing application?


What should be done? Let me know asap.

Hi Tarun,


Are you getting the error when importing the eclipse exported project into Android studio or you are getting the error when creating the project from scratch ?

If you are getting an issue with particular project, please share the project, so that we can test the scenario in our environment. We are really sorry for this inconvenience.

I am getting this issue when creating project from the scratch.Not for a particular project.I tried for both android.pdf and android.word i am getting the same issue.

I tried to integrate aspose.cells for android in android studio I getting the following error:


ERROR: Registry editing has been disabled by your
administrator.<o:p></o:p>

ERROR: Registry editing has been disabled by your administrator.

ERROR: Registry editing has been disabled by your administrator.

ERROR: Registry editing has been disabled by your administrator.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

ERROR: Registry editing has been disabled by your administrator.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

:app:dexDebug

ERROR: Registry editing has been disabled by your administrator.

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher


What should be done?

Hi Tarun,


Thanks for sharing the details.

I have logged an investigation ticket as PDFANDROID-401 regarding Aspose.Pdf for Android integration with Android Development studio, so that we can figure out the reasons causing this issue. We
will investigate this issue in details and will keep you updated on the status
of a correction.
We
apologize for your inconvenience.

However concerning to Aspose.Cells for Android usage, I have intimated the respective team and they will be further looking into this matter.

I have tried integration of aspose in eclipse as well as in android studio. But for both the cases I am getting memory error. I case of eclipse there was heap size error and for android there was GC overhead limit exceeded.


I believe that there is some issue of memory in the jar file of aspose that is leading to this error.

I am attaching the error occured in android studio while running this code.
Hi,

For the error:

Tarun Rai:
I tried to integrate aspose.cells for android in android studio I getting the following error:

ERROR: Registry editing has been disabled by your administrator.

.........

This version of D:\Studio sdk\tools\lib\find_java64.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

..........


Seeing the error you pasted, we think this is due to the fact that you are using JAVA 64-bit on a 32-bit system. The issue is not concerned with Aspose.Cells for Android by any means. So, you should use 32-bit JDK/JRE for your 32-bit OS system accordingly.


Thank you.

Hi Tarun,

Tarun Rai:
I have tried integration of aspose in eclipse as well as in android studio. But for both the cases I am getting memory error. I case of eclipse there was heap size error and for android there was GC overhead limit exceeded.

I believe that there is some issue of memory in the jar file of aspose that is leading to this error.

I am attaching the error occured in android studio while running this code.

Please increase JVM heap size in eclipse it will resolve the issue.

-Xms512
-Xmx2048

XXMaxPermSize=256m

And for memory issue in android studio, you should to adjust jvm args for dex memory in gradle. Please set javaMaxHeapSize property in dex option in build.gradle as following. Hopefully it will resolve the memory issue.

....
buildTypes {
release {
minifyEnabled
false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable
true
}
}
dexOptions {
javaMaxHeapSize "4g"
}
....

Please feel free to contact us for any further assistance.

Best Regards,

I did the required change now when I am running the application of aspose.pdf for android I am getting StackOverFlowError-stack size 8 mb.


I am attaching the error screenshot.

Hi Tarun,


Thanks for your feedback. Please share your build.gradle file and please also source your sample code along with any source document that you are using in the code. So we will look into it and provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

I am trying to share with you the source code with you but whilw uploading the zip file I am getting 404 error. I tried it through E-mail but there also I got Error404.

Hi Tarun,


Thanks for your feedback. There would be some network issue. I have just tested the functionality, it is working fine. Please try it again it should work.

Best Regards,

Below is the aspose.cell code for android studio it is showing GC limit exceeded error.(AsposeCells.zip)



I tried many times its showing same error.

Hi Tarun,


Thanks for sharing your sample project. I have tested your project and noticed that you have not added dexOptions to increase the heap memory as suggested above, so getting the GC limit exceeded error. I have included the dexOptions in build.gradle and the issue resolved, please find attached screenshot for reference. Please add dexOptions, it will resolve the memory issue.

We are sorry for the inconvenience caused.

Best Regards,

I tried to include the dexOption in build.gradle but after including it build.gradle was facing issues on sync it with project. So I was not able to execute the program.

Hi Tarun,


Thanks for your feedback. Please confirm the error message you are getting, so we look into it and suggest you accordingly.

Best Regards,