Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing classes detected while running R8. #2076

Open
waqas7eleven opened this issue Apr 13, 2024 · 1 comment
Open

Missing classes detected while running R8. #2076

waqas7eleven opened this issue Apr 13, 2024 · 1 comment

Comments

@waqas7eleven
Copy link

Describe the bug
While building the app with:

minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

and with the following dependencies:

implementation "io.opentelemetry:opentelemetry-api:1.18.0" implementation "io.opentelemetry:opentelemetry-context:$1.18.0" implementation ("com.microsoft.identity.client:msal:5.2.1") { exclude group:'io.opentelemetry' exclude group:'com.microsoft.device.display' } implementation "com.azure:azure-identity:1.10.0"

getting following errors from R8 minification:

Missing class com.microsoft.device.display.DisplayMask (referenced from: android.graphics.Rect com.microsoft.identity.common.internal.ui.DualScreenActivity.getHinge(android.content.Context, int)) Missing class edu.umd.cs.findbugs.annotations.NonNull (referenced from: java.util.Map com.microsoft.identity.common.java.challengehandlers.PKeyAuthChallenge.getChallengeHeaderWithSignedJwt(com.microsoft.identity.common.java.challengehandlers.IDeviceCertificate) and 13 other contexts) Missing class edu.umd.cs.findbugs.annotations.Nullable (referenced from: android.app.Activity com.microsoft.identity.common.internal.platform.AndroidPlatformUtil.mActivity and 297 other contexts) Missing class edu.umd.cs.findbugs.annotations.SuppressFBWarnings (referenced from: boolean com.microsoft.identity.common.crypto.AndroidWrappedKeyLoader.sSkipKeyInvalidationCheck and 76 other contexts) Missing class io.micrometer.context.ContextAccessor (referenced from: reactor.netty.contextpropagation.ChannelContextAccessor) Missing class jakarta.servlet.ServletRequest (referenced from: com.nimbusds.oauth2.sdk.http.HTTPRequest com.nimbusds.oauth2.sdk.http.JakartaServletUtils.createHTTPRequest(jakarta.servlet.http.HttpServletRequest, long) and 1 other context) Missing class jakarta.servlet.http.HttpServletRequest (referenced from: com.nimbusds.oauth2.sdk.http.HTTPRequest com.nimbusds.oauth2.sdk.http.JakartaServletUtils.createHTTPRequest(jakarta.servlet.http.HttpServletRequest) and 2 other contexts) Missing class jakarta.servlet.http.HttpServletResponse (referenced from: void com.nimbusds.oauth2.sdk.http.JakartaServletUtils.applyHTTPResponse(com.nimbusds.oauth2.sdk.http.HTTPResponse, jakarta.servlet.http.HttpServletResponse)) Missing class javax.servlet.ServletRequest (referenced from: com.nimbusds.oauth2.sdk.http.HTTPRequest com.nimbusds.oauth2.sdk.http.ServletUtils.createHTTPRequest(javax.servlet.http.HttpServletRequest, long) and 1 other context) Missing class javax.servlet.http.HttpServletRequest (referenced from: com.nimbusds.oauth2.sdk.http.HTTPRequest com.nimbusds.oauth2.sdk.http.ServletUtils.createHTTPRequest(javax.servlet.http.HttpServletRequest) and 2 other contexts) Missing class javax.servlet.http.HttpServletResponse (referenced from: void com.nimbusds.oauth2.sdk.http.ServletUtils.applyHTTPResponse(com.nimbusds.oauth2.sdk.http.HTTPResponse, javax.servlet.http.HttpServletResponse)) Missing class javax.xml.stream.XMLStreamException (referenced from: java.lang.Object com.azure.core.implementation.ReflectionSerializable$XmlStreamExceptionCallable.call(java.lang.Object[]) and 1 other context) Missing class net.shibboleth.utilities.java.support.xml.SerializeSupport (referenced from: java.lang.String com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.createAsString(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential)) Missing class org.cryptomator.siv.SivMode (referenced from: org.cryptomator.siv.SivMode com.nimbusds.openid.connect.sdk.id.SIVAESBasedPairwiseSubjectCodec.AES_SIV and 3 other contexts) Missing class org.joda.time.DateTime (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.core.config.InitializationException (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion() and 1 other context) Missing class org.opensaml.core.config.InitializationService (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion() and 1 other context) Missing class org.opensaml.core.xml.XMLObject (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 5 other contexts) Missing class org.opensaml.core.xml.XMLObjectBuilder (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion() and 1 other context) Missing class org.opensaml.core.xml.XMLObjectBuilderFactory (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion() and 1 other context) Missing class org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion() and 4 other contexts) Missing class org.opensaml.core.xml.io.Marshaller (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 1 other context) Missing class org.opensaml.core.xml.io.MarshallerFactory (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 1 other context) Missing class org.opensaml.core.xml.io.MarshallingException (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 1 other context) Missing class org.opensaml.core.xml.io.Unmarshaller (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionValidator.parse(java.lang.String)) Missing class org.opensaml.core.xml.io.UnmarshallerFactory (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionValidator.parse(java.lang.String)) Missing class org.opensaml.core.xml.io.UnmarshallingException (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionValidator.parse(java.lang.String)) Missing class org.opensaml.core.xml.schema.XSString (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion()) Missing class org.opensaml.core.xml.schema.impl.XSStringBuilder (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion()) Missing class org.opensaml.saml.saml2.core.Assertion (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 6 other contexts) Missing class org.opensaml.saml.saml2.core.Attribute (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AttributeStatement (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AttributeValue (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.toSAML2Assertion()) Missing class org.opensaml.saml.saml2.core.Audience (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AudienceRestriction (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AuthnContext (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AuthnContextClassRef (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.AuthnStatement (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.Conditions (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.Issuer (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.NameID (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.Subject (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.SubjectConfirmation (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.saml2.core.SubjectConfirmationData (referenced from: com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails.parse(org.opensaml.saml.saml2.core.Assertion) and 1 other context) Missing class org.opensaml.saml.security.impl.SAMLSignatureProfileValidator (referenced from: void com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionValidator.verifySignature(org.opensaml.xmlsec.signature.Signature, java.security.Key)) Missing class org.opensaml.security.credential.BasicCredential (referenced from: java.lang.String com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.createAsString(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.security.interfaces.RSAPublicKey, java.security.interfaces.RSAPrivateKey) and 1 other context) Missing class org.opensaml.security.credential.Credential (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 4 other contexts) Missing class org.opensaml.security.credential.UsageType (referenced from: java.lang.String com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.createAsString(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.security.interfaces.RSAPublicKey, java.security.interfaces.RSAPrivateKey) and 1 other context) Missing class org.opensaml.xmlsec.signature.Signature (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 2 other contexts) Missing class org.opensaml.xmlsec.signature.support.SignatureException (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential) and 1 other context) Missing class org.opensaml.xmlsec.signature.support.SignatureValidator (referenced from: void com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionValidator.verifySignature(org.opensaml.xmlsec.signature.Signature, java.security.Key)) Missing class org.opensaml.xmlsec.signature.support.Signer (referenced from: org.opensaml.saml.saml2.core.Assertion com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionFactory.create(com.nimbusds.oauth2.sdk.assertions.saml2.SAML2AssertionDetails, java.lang.String, org.opensaml.security.credential.Credential)) Missing class reactor.blockhound.integration.BlockHoundIntegration (referenced from: io.netty.util.internal.Hidden$NettyBlockHoundIntegration and 1 other context)

Gradle version: 8.3
Android SDK version: 34

@SkyleKayma
Copy link

SkyleKayma commented Jul 11, 2024

This issue appears with Gradle 8.X and R8 becoming more strict.
Do you have anything to share that has been done in the last 3 months ? It's quite problematic here, we are not ok to add 30 rules in proguard, it should be included in this library.

This is the file generated by Android Studio with the missing rules:

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.crypto.tink.subtle.Ed25519Sign$KeyPair
-dontwarn com.google.crypto.tink.subtle.Ed25519Sign
-dontwarn com.google.crypto.tink.subtle.Ed25519Verify
-dontwarn com.google.crypto.tink.subtle.X25519
-dontwarn com.google.crypto.tink.subtle.XChaCha20Poly1305
-dontwarn com.microsoft.device.display.DisplayMask
-dontwarn edu.umd.cs.findbugs.annotations.NonNull
-dontwarn edu.umd.cs.findbugs.annotations.Nullable
-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings
-dontwarn org.bouncycastle.asn1.ASN1Encodable
-dontwarn org.bouncycastle.asn1.pkcs.PrivateKeyInfo
-dontwarn org.bouncycastle.asn1.x509.AlgorithmIdentifier
-dontwarn org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
-dontwarn org.bouncycastle.cert.X509CertificateHolder
-dontwarn org.bouncycastle.cert.jcajce.JcaX509CertificateHolder
-dontwarn org.bouncycastle.crypto.BlockCipher
-dontwarn org.bouncycastle.crypto.CipherParameters
-dontwarn org.bouncycastle.crypto.InvalidCipherTextException
-dontwarn org.bouncycastle.crypto.engines.AESEngine
-dontwarn org.bouncycastle.crypto.modes.GCMBlockCipher
-dontwarn org.bouncycastle.crypto.params.AEADParameters
-dontwarn org.bouncycastle.crypto.params.KeyParameter
-dontwarn org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider
-dontwarn org.bouncycastle.openssl.PEMKeyPair
-dontwarn org.bouncycastle.openssl.PEMParser
-dontwarn org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter

All of these are gone by removing:

implementation(libs.microsoft.identity) {
    exclude(group = "com.microsoft.device.display")
}

So it comes from this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Investigation Required
Development

No branches or pull requests

2 participants