有线内存不足:Java 堆 space ffmpeg 库错误
Wired Out of memory: Java heap space error with ffmpeg library
嗯,这是我得到的错误:
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>
这是因为:
implementation 'nl.bravobit:android-ffmpeg:1.1.7'
当我删除错误时得到 gone.Well 错误是说将堆大小增加到 1024MB 而我确实将它增加到 10GB 它仍然不是 working.That 是有线的。
org.gradle.jvmargs=-Xmx10000m
还是一样 error.also 试过这个:
<application
android:largeHeap="true">
仍然没有chance.Please不建议使用替代库,因为我不能。
在找到这里之前我已经使用过这个库https://github.com/tanersener/mobile-ffmpeg
它将广泛支持硬件加速和 FFmpeg 命令 运行 比这个 nl.bravobit 库更快。
如果您的应用支持 Lollipop 和 Marshmallow,请使用:
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.LTS'
在 gradle 5 中,他们大大降低了 default memory 要求。
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.
增加客户端内存
GRADLE_OPTS=-Xmx1g ./gradlew build
增加守护程序内存
./gradlew -D org.gradle.jvmargs=-Xmx1g
更新:
为了进一步说明,gradle 使用客户端虚拟机、守护进程虚拟机、工作虚拟机(当 运行 并行时)以及用于某些任务的额外虚拟机。
可以使用 GRADLE_OPTS 环境变量自定义客户端 VM。
可以使用 org.gradle.jvmargs 属性.
自定义守护进程 VM
工作 VM 是从守护程序 VM 派生出来的,因此将使用相同的设置。
可以通过任务自定义每个任务的虚拟机。对于 example
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Xdoclint:none', '-Xlint:none', '-nowarn']
}
根据有关客户端 VM 使用的 gradle 文档:
The client VM only handles command line input/output, so it is rare that one would need to change its VM options.
嗯,这是我得到的错误:
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>
这是因为:
implementation 'nl.bravobit:android-ffmpeg:1.1.7'
当我删除错误时得到 gone.Well 错误是说将堆大小增加到 1024MB 而我确实将它增加到 10GB 它仍然不是 working.That 是有线的。
org.gradle.jvmargs=-Xmx10000m
还是一样 error.also 试过这个:
<application
android:largeHeap="true">
仍然没有chance.Please不建议使用替代库,因为我不能。
在找到这里之前我已经使用过这个库https://github.com/tanersener/mobile-ffmpeg
它将广泛支持硬件加速和 FFmpeg 命令 运行 比这个 nl.bravobit 库更快。
如果您的应用支持 Lollipop 和 Marshmallow,请使用:
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.LTS'
在 gradle 5 中,他们大大降低了 default memory 要求。
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.
增加客户端内存
GRADLE_OPTS=-Xmx1g ./gradlew build
增加守护程序内存
./gradlew -D org.gradle.jvmargs=-Xmx1g
更新:
为了进一步说明,gradle 使用客户端虚拟机、守护进程虚拟机、工作虚拟机(当 运行 并行时)以及用于某些任务的额外虚拟机。
可以使用 GRADLE_OPTS 环境变量自定义客户端 VM。
可以使用 org.gradle.jvmargs 属性.
自定义守护进程 VM工作 VM 是从守护程序 VM 派生出来的,因此将使用相同的设置。
可以通过任务自定义每个任务的虚拟机。对于 example
tasks.withType(JavaCompile) { options.compilerArgs += ['-Xdoclint:none', '-Xlint:none', '-nowarn'] }
根据有关客户端 VM 使用的 gradle 文档:
The client VM only handles command line input/output, so it is rare that one would need to change its VM options.