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

Free Support Forum - aspose.com

java.lang.OutOfMemoryError:Java heap space(Android Application)

After uploading the jar dependency of aspose pdf for android my application doesn’t compile. I get the error java Heap space…
some person have some issue of this?
the jar is 48.000kb . it’s too big?

I have a license and want to know where to put it?
In the gradle?

thanks for the help.

@meilopjo

You can either fetch the API from Aspose Repository in build.gradle or you can place the JAR file in the Libs folder and include it as an external reference to the project. Furthermore, can you please explain what code snippet are you using which is leading to OOM Exception? Please share it with us along with sample files if any. We will test the scenario in our environment and address it accordingly.

Good evening, I actually recovered the Jar in the Aspose repository which I put in the Iibs folder. I added the library to the gradle.
From my project I can see the functions of aspose. PDF for Android but when I try to debug my project after two minutes of compilation it comes out in OOM which says there is no space in the heap

I also tried to get older libraries that weighed less but the problem is the same

Plus my client gave me a product license that I don’t know where to put.

Not how to tell you or show anything else because I do the two necessary operations

1 - copy the jar to the libs directory
2- I add the library to my project

I launch the compilation and it comes out OOM

Thanks.

@meilopjo

We ran a test in our environment and did not notice any issue. It is really hard to determine the cause of the issue at your side without replicating it. Furthermore, regarding license settings, you can set license in a method that runs at the start of the application e.g. at the start of the main activity. You can place the license file in any directory of the application and then use it in your code. Please check licensing section of the API documentation.

Please also share complete environment details with us so that we can again try to reproduce the similar issue at our end that you are facing and further proceed to assist you accordingly.

HI!
i run android studio Arctic Fox
Rubtime version:11.0.10+
on windows 10 OS

my device is Samsung Galaxi TAB A7
SM-T505

my gradle files

Thanks

apply plugin: 'com.android.application'

android {
   
    compileSdkVersion 29
    buildToolsVersion = '29.0.3'

    defaultConfig {
        applicationId "it.htg.holosdrivers"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 42
        versionName '4.0.5'
        signingConfig signingConfigs.config
        useLibrary  'org.apache.http.legacy'
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.config
}
    }

    productFlavors {
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    dexOptions {
        javaMaxHeapSize "4G"
    }
}

dependencies {
    implementation  files('libs/DataCollection.jar')
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'commons-net:commons-net:3.6'
    implementation 'com.jakewharton:butterknife:10.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'org.jetbrains:annotations:15.0'
    implementation files('libs/aspose-pdf-20.11-android.via.java.jar')
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
    implementation 'ch.acra:acra:4.5.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.1'
    implementation 'com.google.android.gms:play-services-identity:17.0.1'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.zxing:core:3.4.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'org.apache.commons:commons-lang3:3.11'
    implementation 'commons-io:commons-io:2.4'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'joda-time:joda-time:2.10.8'

    }

@meilopjo

We have tested the scenario in Android Studio 3.2.1 and Windows 10 ENx64. We were unable to reproduce the issue. However, we have logged an investigation ticket as PDFANDROID-620 in our issue management system to further look into this case. We will further analyze it and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

PS: Please also confirm if you tried increasing the Java Heap Size? What is the Java Heap Size at your end currently?

Hi!
i’m still waiting to know how to procced…
I give you all informations about my settings and how i proceed with the Aspose library and you ask me to be patient but my client ask me about news and i don’t know what to answer.

  1. i copied the jar file in the directory libs

2)I wrote the dependency in the wright place

Just want to know which answer to give to my client.

Thanks.

Philippe Meilo.

Hi!
for more informations

my heap memore is -Xms1024m at the moment

java.lang.OutOfMemoryError: Java heap space

thanks

image.png (7.67 KB)

image.png (106 KB)

@meilopjo

We really apologize for the inconvenience. Please note that the issue does not seem related to the API but a specific environment of yours. We already tried by following the same steps in our environment and did not notice any issue.

Can you please try following:

  • After copying the JAR in *libs folder, right click on the JAR file and select “Add as Library” and try to build again
  • You can also check this answer on Stackoverflow where someone was having the similar issue and resolved it by changing some settings in his environment

Furthermore, we have recorded your concerns and will surely consider them during ticket investigation. We will let you know as soon as we have investigation results. Please give us some time.