Describe the bug
MSAL 8.3.2 introduces a missing R8/ProGuard consumer rule for com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory. This class is referenced by the transitive dependency com.microsoft.identity.deviceregistration but is not included as a runtime dependency, nor is a -dontwarn consumer rule shipped with the AAR.
This causes Release builds with R8 minification to fail. The issue does not occur with MSAL 8.3.0 and 8.3.1.
Smartphone (please complete the following information):
Device: All
Android Version: API 31+
MSAL Version: 8.3.2 (works fine with 8.3.0 or 8.3.1)
Build environment:
Android Gradle Plugin (AGP): 9.0.1
Gradle: 9.1.0
Stacktrace
AGPBI: {"kind":"error","text":"Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/.../app/build/intermediates/mapping/fredAbnahmeRelease/minifyFredAbnahmeReleaseWithR8/missing_rules.txt.","sources":[{}]}
AGPBI: {"kind":"error","text":"Missing class com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory (referenced from: void com.microsoft.identity.deviceregistration.java.protocol.packer.DeviceRegistrationProtocolMoshiSerializer.())","sources":[{}],"tool":"R8"}
Execution failed for task ':app:minifyFredAbnahmeReleaseWithR8'.
A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
Compilation failed to complete
To Reproduce
Steps to reproduce the behavior:
Use com.microsoft.identity.client:msal:8.3.2 as a dependency
Enable R8 minification (isMinifyEnabled = true) for a release build type
Build a release variant (e.g. ./gradlew assembleRelease)
Build fails at minifyWithR8 task
Expected behavior
MSAL 8.3.2 should either:
Include com.squareup.moshi:moshi-adapters as a transitive runtime dependency, or
Ship a consumer ProGuard/R8 rule (-dontwarn com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory) in the AAR's consumer-rules.pro
Additional context
Additional context
The issue is caused by com.microsoft.identity.deviceregistration.java.protocol.packer.DeviceRegistrationProtocolMoshiSerializer referencing PolymorphicJsonAdapterFactory in its static initializer ()
MSAL 8.3.1 does not have this issue — the problem was introduced in 8.3.2
Describe the bug
MSAL 8.3.2 introduces a missing R8/ProGuard consumer rule for com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory. This class is referenced by the transitive dependency com.microsoft.identity.deviceregistration but is not included as a runtime dependency, nor is a -dontwarn consumer rule shipped with the AAR.
This causes Release builds with R8 minification to fail. The issue does not occur with MSAL 8.3.0 and 8.3.1.
Smartphone (please complete the following information):
Device: All
Android Version: API 31+
MSAL Version: 8.3.2 (works fine with 8.3.0 or 8.3.1)
Build environment:
Android Gradle Plugin (AGP): 9.0.1
Gradle: 9.1.0
Stacktrace
AGPBI: {"kind":"error","text":"Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/.../app/build/intermediates/mapping/fredAbnahmeRelease/minifyFredAbnahmeReleaseWithR8/missing_rules.txt.","sources":[{}]}
AGPBI: {"kind":"error","text":"Missing class com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory (referenced from: void com.microsoft.identity.deviceregistration.java.protocol.packer.DeviceRegistrationProtocolMoshiSerializer.())","sources":[{}],"tool":"R8"}
Execution failed for task ':app:minifyFredAbnahmeReleaseWithR8'.
To Reproduce
Steps to reproduce the behavior:
Use com.microsoft.identity.client:msal:8.3.2 as a dependency
Enable R8 minification (isMinifyEnabled = true) for a release build type
Build a release variant (e.g. ./gradlew assembleRelease)
Build fails at minifyWithR8 task
Expected behavior
MSAL 8.3.2 should either:
Include com.squareup.moshi:moshi-adapters as a transitive runtime dependency, or
Ship a consumer ProGuard/R8 rule (-dontwarn com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory) in the AAR's consumer-rules.pro
Additional context
Additional context
The issue is caused by com.microsoft.identity.deviceregistration.java.protocol.packer.DeviceRegistrationProtocolMoshiSerializer referencing PolymorphicJsonAdapterFactory in its static initializer ()
MSAL 8.3.1 does not have this issue — the problem was introduced in 8.3.2