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

[Flutter-Android] [R8-Proguard] Minify issue, missing classes when build app. #1712

Open
hoyiliang opened this issue Oct 18, 2024 · 0 comments
Labels
Communication - Chat customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@hoyiliang
Copy link

hoyiliang commented Oct 18, 2024

Good day, we will refer to the following error log.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in .../build/app/outputs/mapping/qaRelease/missing_rules.txt.
ERROR: R8: Missing class aQute.bnd.annotation.spi.ServiceProvider (referenced from: com.ctc.wstx.dtd.DTDSchemaFactory and 5 other contexts)
Missing class com.sun.activation.registries.LogSupport (referenced from: void javax.activation.MailcapCommandMap.<init>()  @and 4 other contexts)
Missing class com.sun.activation.registries.MailcapFile (referenced from: com.sun.activation.registries.MailcapFile[] javax.activation.MailcapCommandMap.DB and 5 other contexts)
Missing class java.awt.datatransfer.DataFlavor (referenced from: java.awt.datatransfer.DataFlavor[] javax.activation.DataHandler.emptyFlavors and 4 other contexts)
Missing class java.awt.datatransfer.Transferable (referenced from: javax.activation.DataHandler)
Missing class java.beans.BeanInfo (referenced from: void org.apache.log4j.config.PropertySetter.introspect())
Missing class java.beans.IntrospectionException (referenced from: void org.apache.log4j.config.PropertySetter.introspect())
Missing class java.beans.Introspector (referenced from: void org.apache.log4j.config.PropertySetter.introspect() and 2 other contexts)
Missing class java.beans.PropertyDescriptor (referenced from: java.beans.PropertyDescriptor[] org.apache.log4j.config.PropertySetter.props and 4 other contexts)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyQaReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete

After some research around the web, I am expected to add some keep rules into proguard-rules.pro file to keep the classes that the SDK requires.

Some notes:

  1. Only happens when building in Release mode because the build script only enables Minify in Release mode by default.
  2. Using -dontwarn in the missing_rules.txt is not the solution. The app crashes when I try to call the SDK's methods.
  3. I have tried to include the following keep rules, but the app still crashes when I call the SDK's methods.:
-keep class aQute.* { *; }
-keep class com.sun.* { *; }
-keep class java.awt.* { *; }
-keep class java.beans.* { *; }
-keep class com.skype.rt.** {*;}
-keep class com.azure.** {*;}
-keep class com.skype.android.** {*;}
-keep class com.microsoft.media.** {*;}
-keep class com.microsoft.dl.** {*;}
  1. The libraries I am using, reference: https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started?tabs=windows&pivots=programming-language-android
build.gradle
dependencies {
    implementation "com.azure.android:azure-communication-common:1.2.1"
    implementation "com.azure.android:azure-communication-chat:2.0.3"
    implementation "org.slf4j:slf4j-log4j12:1.7.29"
}

Please assist on this issue. Preferably I do not need to disable the Minify feature enabled by default.

Thanks!

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 18, 2024
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Communication - Chat customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants