[英]Got OutOfMemoryError after update Android Gradle Plugin to 3.6.1 from 3.5.3 when run unit test
After update to use Android Gradle Plugin 3.6.1 from 3.5.3, our unit test keeps getting OutOfMemoryError exception randomly.从 3.5.3 更新到使用 Android Gradle 插件 3.6.1 后,我们的单元测试不断随机获取 OutOfMemoryError 异常。
These are the crash logs:这些是崩溃日志:
Caused by: com.android.ide.common.workers.WorkerExecutorException: 1 exception was raised by workers: java.lang.OutOfMemoryError at com.android.ide.common.workers.ExecutorServiceAdapter.await(ExecutorServiceAdapter.kt:108) at com.android.ide.common.workers.ExecutorServiceAdapter.close(ExecutorServiceAdapter.kt:118) at kotlin.io.CloseableKt.closeFinally(Closeable.kt:53) at com.android.build.gradle.internal.res.GenerateLibraryRFileTask.doFullTaskAction(GenerateLibraryRFileTask.kt:120) at com.android.build.gradle.internal.tasks.IncrementalTask.handleIncrementalInputs(IncrementalTask.kt:107) at com.android.build.gradle.internal.tasks.IncrementalTask.access$handleIncrementalInputs(IncrementalTask.kt:64) at com.android.build.gradle.internal.tasks.IncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(AndroidVariantTask.kt:73)
As my investigation.作为我的调查。 AGP 3.6.x changed the way to generate the R file.
AGP 3.6.x 改变了生成 R 文件的方式。 And the crash happens in this line of code: https://android.googlesource.com/platform/tools/base/+/studio-master-dev/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/res/GenerateLibraryRFileTask.kt#120
崩溃发生在这行代码中: https : //android.googlesource.com/platform/tools/base/+/studio-master-dev/build-system/gradle-core/src/main/java/com/ android/build/gradle/internal/res/GenerateLibraryRFileTask.kt#120
So far, what I have tried are:到目前为止,我尝试过的是:
Try to play with some gradle flags.尝试使用一些 gradle 标志。 But so far, there is no luck.
但到目前为止,还没有运气。
Play around with some testOptions flags ( https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html ), for example forkEvery, maxParallelForks.使用一些 testOptions 标志( https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html ),例如 forkEvery、maxParallelForks。 But I am not sure it would help, because the failure happens on the building phrase.
但我不确定它会有所帮助,因为失败发生在构建短语上。
I am trying to get the heapdump but it's kind of difficult because the OOM happens randomly.我正在尝试获取 heapdump,但这有点困难,因为 OOM 是随机发生的。
My setup:我的设置:
It will be very appreciated if anyone of you would suggest any solution or direction to investigate如果你们中的任何人建议任何解决方案或方向进行调查,我们将不胜感激
Just for your info.仅供参考。 I have to fire an issue too google here https://issuetracker.google.com/u/1/issues/151460310
我也必须在谷歌这里发一个问题https://issuetracker.google.com/u/1/issues/151460310
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.