问题
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:
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.
回答2:
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'
来源:https://stackoverflow.com/questions/56271816/wired-out-of-memory-java-heap-space-error-with-ffmpeg-library