0

Well this is the error I get:

Out of memory: Java heap space.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
<em>org.gradle.jvmargs=-Xmx1024m</em>

and it is because of:

implementation 'nl.bravobit:android-ffmpeg:1.1.7'

when I remove that the error gets gone.Well the error is saying increase the heap size to 1024MB and I did increase it to 10GB it's not still working.That's what is wired.

org.gradle.jvmargs=-Xmx10000m

still getting the same error.also tried this:

<application
        android:largeHeap="true">

still no chance.Please do not suggest to use an alternative library because I can't.

1
  • it is not OOM on Android, it runs out of memory on your PC when building your app. It has nothing to do with manifest file Commented May 23, 2019 at 10:50

2 Answers 2

1

In gradle 5 they vastly reduced the default memory requirements.

The command line client now starts with 64MB of heap instead of 1GB. This may affect builds running directly inside the client VM using --no-daemon mode. We discourage the use of --no-daemon, but if you must use it, you can increase the available memory using the GRADLE_OPTS environment variable.

The Gradle daemon now starts with 512MB of heap instead of 1GB. Large projects may have to increase this setting using the org.gradle.jvmargs property.

All workers, including compilers and test executors, now start with 512MB of heap. The previous default was 1/4th of physical memory. Large projects may have to increase this setting on the relevant tasks, e.g. JavaCompile or Test.

Increase Client Memory

GRADLE_OPTS=-Xmx1g ./gradlew build

Increase Daemon Memory

./gradlew -D org.gradle.jvmargs=-Xmx1g

Update:

For additional clarification, gradle uses a client VM, a daemon VM, worker VMs (when run in parallel), and additional VMs for certain tasks.

The client VM can be customized using the GRADLE_OPTS environment variable.

The daemon VM can be customized using the org.gradle.jvmargs property.

The worker VMs are forked from the daemon VM so will use the same settings.

The per task VMs can be customized through the task. For example

tasks.withType(JavaCompile) { options.compilerArgs += ['-Xdoclint:none', '-Xlint:none', '-nowarn'] }

According to the gradle documentation on Client VM usage:

The client VM only handles command line input/output, so it is rare that one would need to change its VM options.

Sign up to request clarification or add additional context in comments.

7 Comments

thank you but I'm using gradle 4 do I need to do that?
Gradle 5 just reduced the defaults from Gradle 4. Either way, there still is a client and a daemon which have separate memory settings. You may want to try increasing the client memory as well. It might depend on that plugin which one is used.
I've already done daemon.but where to put GRADLE_OPTS=-Xmx1g ./gradlew build
@stevemoretz It is an environment variable, so the example I gave was assuming bash and just on the command-line that you execute the gradle-wrapper with. According to the gradle documentation, it shouldn't be necessary to increase the client memory but I though it was worth a try.
I updated my answer to add additional notes. I can't seem to find it now but I remember reading somewhere that certain plugins may require additional client memory. I generally just use the defaults until it doesn't work and then it is a bit of trial and error to set the correct memory for the right VM.
|
0

I have used this library before I found here https://github.com/tanersener/mobile-ffmpeg

It will have vast support of hardware acceleration and the FFmpeg commands run faster than this nl.bravobit library.

If your app supports Lollipop and Marshmallow use:

implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.LTS'

5 Comments

Thank you but I already mentioned I can't use another library.This library is used in a library that I have and I can't change that second library so I can't use another ffmpeg library simply I can't.
It may be the version of the library you are using as I have used 1.1.5 and it was working well in my application. You can try with version 1.1.5
Thank you I've already used that first it didn't work and then got 1.1.7 and still no luck.So did you use it with androidx?Because that's what I'm doing
No, I didn't use AndroidX in my project.
Well I suggest you to do for your own sake.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.