Issue on R8 minify
Asked Answered
A

2

10

I installed the new version of Android Studio and did update of my project (without changing dependencies) and i had this issue:

Missing class com.google.protobuf.java_com_google_android_gmscore_sdk_target_granule__proguard_group_gtm_N1281923064GeneratedExtensionRegistryLite$Loader (referenced from: java.util.List kotlinx.coroutines.internal.FastServiceLoader.load(java.lang.Class, java.lang.ClassLoader))
Missing class org.bouncycastle.jsse.BCSSLParameters (referenced from: void okhttp3.internal.platform.BouncyCastlePlatform.configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List) and 1 other context)
Missing class org.bouncycastle.jsse.BCSSLSocket (referenced from: void okhttp3.internal.platform.BouncyCastlePlatform.configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List) and 5 other contexts)
Missing class org.bouncycastle.jsse.provider.BouncyCastleJsseProvider (referenced from: void okhttp3.internal.platform.BouncyCastlePlatform.<init>())
Missing class org.conscrypt.Conscrypt$Version (referenced from: boolean okhttp3.internal.platform.ConscryptPlatform$Companion.atLeastVersion(int, int, int))
Missing class org.conscrypt.Conscrypt (referenced from: boolean okhttp3.internal.platform.ConscryptPlatform$Companion.atLeastVersion(int, int, int) and 4 other contexts)
Missing class org.conscrypt.ConscryptHostnameVerifier (referenced from: okhttp3.internal.platform.ConscryptPlatform$DisabledHostnameVerifier)
Missing class org.openjsse.javax.net.ssl.SSLParameters (referenced from: void okhttp3.internal.platform.OpenJSSEPlatform.configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List))
Missing class org.openjsse.javax.net.ssl.SSLSocket (referenced from: void okhttp3.internal.platform.OpenJSSEPlatform.configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List) and 1 other context)
Missing class org.openjsse.net.ssl.OpenJSSE (referenced from: void okhttp3.internal.platform.OpenJSSEPlatform.<init>())

I tried some things on proguard file to fix the issue that i found online. But it didn't work.

Agentival answered 20/4, 2023 at 11:8 Comment(0)
P
15

This problem is because with AGP 8.y.z, Missing Classes Warnings from R8 are no longer just warnings and have become a build error.

To work around this problem what can be done at the moment is to add dontwarn to the classes that are causing the problem, for example:

proguard-rules.pro:

-dontwarn com.google.protobuf.java_com_google_android_gmscore_sdk_target_granule__proguard_group_gtm_N1281923064GeneratedExtensionRegistryLite$Loader
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

The class names will most likely be underlined in red, as you don't have direct access to them because they are internally in the libraries you are using, but it's okay to ignore it.

We'll have to wait for future updates where these issues are fixed by the libraries suffering from this R8 change.

Persnickety answered 20/4, 2023 at 12:8 Comment(4)
Thank you for your answer and your explanations. I just saw that, just before your answer, on folder build/outputs/mapping there were a proguard file that exactly saying to do that. Have a nice day.Agentival
I finally downgrade, because of crash at start on release. I will wait for update.Agentival
If the crash you are seeing seems related to the upgrade please file an issue. If it looks R8 related you can use issuetracker.google.com/issues/new?component=326788.Undamped
Simply Upgrade OkHttp to 4.11.0 for proguard Instead of adding above answer proguard items.Ianiana
G
0

If you've recently upgraded your AGP to version 8.+ or higher, you can resolve issues by adding the following line to your gradle.properties file:

android.enableR8.fullMode=false
Graniela answered 26/7 at 12:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.