由于某些警告而无法生成已签名的 APK

Cannot generate the signed APK due to some warning

在生成签名的 APK 时,我收到了这些警告

Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean

我应该怎么做才能避免这些警告?在此先感谢您的帮助。

在 proguard-rules.pro 文件中添加

-dontwarn java.lang.management.**

这个警告是可以避免的