问题描述
我正在使用Android Studio 3.4(金丝雀9),当我构建我的应用程序时,它失败并出现以下错误
I'm using Android Studio 3.4 (Canary 9), when I build my app, it failed with the following error
R8是 实验功能.如果您遇到任何问题,请提交错误 在 https://issuetracker.google.com 上,使用收缩器(R8)"作为组件 姓名.您可以通过使用以下命令更新gradle.properties来禁用R8: 'android.enableR8 = false'.
R8 is an experimental feature. If you experience any issues, please file a bug at https://issuetracker.google.com, using 'Shrinker (R8)' as component name. You can disable R8 by updating gradle.properties with 'android.enableR8=false'.
AGPBI:{种类":警告",文本":缺少类别: java.lang.instrument.ClassFileTransformer,"源:[{}],"工具:" D8}
AGPBI: {"kind":"warning","text":"Missing class: java.lang.instrument.ClassFileTransformer","sources":[{}],"tool":"D8"}
任务:app:transformClassesAndResourcesWithR8ForDebug失败
Task :app:transformClassesAndResourcesWithR8ForDebug FAILED
失败:构建失败,并出现异常.
FAILURE: Build failed with an exception.
- 出了什么问题:任务':app:transformClassesAndResourcesWithR8ForDebug'的执行失败.
超出了GC开销限制
当我通过将android.enableR8=false
放入 gradle.properties 来禁用R8时.一切正常.
When I disable R8 by putting android.enableR8=false
into gradle.properties. Everything is working fine.
那么如何在不禁用R8 Shrinker的情况下解决此错误?因为我真的很想测试R8的功能.
So how can I fix this error without disable R8 Shrinker? Because I'm really want to test functionality of R8.
推荐答案
正如您所说的,您没有使用任何自定义的JVM args
,请尝试一下.
As you said you are not using any custom JVM args
, try it out.
在您的gradle.properties
文件中,尝试内存设置的多个值一个>.例如,尝试设置
In your gradle.properties
file try several values for memory settings. For example try to set
org.gradle.jvmargs=-Xmx4096m
如评论部分所建议:
该设置对于调整内存设置特别有用.
The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs = -Xmx1536m
org.gradle.jvmargs=-Xmx1536m
我在项目中使用了R8,并且一切正常.
I've used R8 in my project and all worked fine.
这篇关于在Android Studio 3.4中启用R8 Shrinker时,超出了GC开销限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!