5

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.

JpA
  • 51
  • 2

1 Answers1

9

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.

Thales Isidoro
  • 1,753
  • 1
  • 5
  • 19
  • 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. – JpA Apr 20 '23 at 12:17
  • I finally downgrade, because of crash at start on release. I will wait for update. – JpA Apr 20 '23 at 14:00
  • If the crash you are seeing seems related to the upgrade please file an issue. If it looks R8 related you can use https://issuetracker.google.com/issues/new?component=326788. – sgjesse Apr 21 '23 at 07:44
  • This works just fine, thank you – Neo Jul 17 '23 at 14:12
  • Simply Upgrade **OkHttp** to `4.11.0` for proguard Instead of adding above answer **proguard** items. – Zar E Ahmer Jul 31 '23 at 11:40