lisa
lisa

Reputation: 53

Missing class java.lang.management.ManagementFactory when use the obfuscation method Generate Signed APK

When I use the obfuscation method Generate Signed APK (minifyEnabled true shrinkResources true), an error will be reported. The error message is as follows. But when it is not confused (minifyEnabled false shrinkResources false), it is successful.

Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in ...\missing_rules.txt.

Missing class java.lang.management.ManagementFactory (referenced from: long org.junit.internal.runners.statements.FailOnTimeout.cpuTime(java.lang.Thread) and 1 other context)
Missing class java.lang.management.RuntimeMXBean (referenced from: void org.junit.rules.DisableOnDebug.<init>(org.junit.rules.TestRule))
Missing class java.lang.management.ThreadMXBean (referenced from: long org.junit.internal.runners.statements.FailOnTimeout.cpuTime(java.lang.Thread))

I need to successfully Generate Signed APK using obfuscation. What can I do?

Upvotes: 5

Views: 2178

Answers (1)

Kishan Viramgama
Kishan Viramgama

Reputation: 1234

Add this option in app level build.gradle file

android {
    lintOptions {
      checkReleaseBuilds false
      abortOnError false
    }
}

Upvotes: 0

Related Questions