CommandersAct / AndroidV5

Other
5 stars 1 forks source link

Proguard rules for Gradle 8.5+ #8

Open Aure77 opened 2 months ago

Aure77 commented 2 months ago

Since I upgrade to Gradle 8.5 and com.android.tools.build:gradle:8.2.2 with proguard enabled but there is some changes with this version. Missing class are now blocking minify process, ex: ERROR: R8: Missing class com.tagcommander.lib.tciab.consent.TCCMPStorage (referenced from: void com.tagcommander.lib.consent.TCConsent.loadIAB() and 4 other contexts)

Can you provide proguard rules for each of your module ? I only found info for TCCore. Need rules for TCConsent & TCIAB

CommandersAct commented 2 months ago

Hello ! The doc in TCCore says:

-keep class com.tagcommander.lib.* { ; }

All modules are inside com.tagcommander.lib.** so it's pretty strange if it's not working with this specifically on Consent and IAB

Basically it's about telling ProGuard what not to remove so there should be no reason for it to not find "com.tagcommander.lib.tciab.consent.TCCMPStorage"

It's more likely that you are completely missing the IAB module since the error is pointing to Consent calling IAB so proGuard seems to be keeping Consent.

Aure77 commented 2 months ago

I've been using -keep class com.tagcommander.lib.** { *; } without any issues until today. However, after upgrading to Gradle 8.5+, I encountered problems with ProGuard. I only utilize the core, ServerSide, and Consent dependencies, and I don't explicitly include TCIAB in my dependencies.

To temporarily fix my build, I omitted the TCIAB package by adding: -dontwarn com.tagcommander.lib.tciab.**

However, I'm unsure if this is the correct approach.

Aure77 commented 2 months ago

I think it's due to android.enableR8.fullMode=true by default on Gradle 8+ (previously was false). https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes?hl=fr#default-changes

R8 full mode performs more aggressive optimizations...

ahakimsaid commented 2 months ago

Hi @Aure77, Is everything working correctly for you now? Please update so we can advance further