From a41402f01373a4a42be3ce24e7fda3a03037c290 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 00:12:17 +0600 Subject: [PATCH 1/9] fix: resolve proguard configuration issues - Update proguard configuration in build.gradle - Add missing dependencies for ProGuard rules - Update Android multidex support version in dependencies in app/build.gradle --- android/build.gradle | 4 ++-- android/proguard-rules.txt | 28 ++++++++++++++++++++++++---- example/android/app/build.gradle | 4 +++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index c33dcee..8559cd6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -59,8 +59,8 @@ android { buildTypes { release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-rules.pro' } } diff --git a/android/proguard-rules.txt b/android/proguard-rules.txt index 1564ced..26933ae 100644 --- a/android/proguard-rules.txt +++ b/android/proguard-rules.txt @@ -8,8 +8,28 @@ # Add any project specific keep options here: # Optimizely --keep class com.optimizely.optimizely_flutter_sdk.** {*;} --keep class com.fasterxml.jackson.** {*;} -# Logback --keep class ch.qos.** { *; } +-keep class com.optimizely.optimizely_flutter_sdk.OptimizelyFlutterSdkPlugin { *; } +-keep class com.optimizely.optimizely_flutter_sdk.** { *; } +-keep class com.optimizely.ab.** { *; } + +# Keep Jackson classes for JSON parsing +-keep class com.fasterxml.jackson.** { *; } +-dontwarn com.fasterxml.jackson.** + +# Keep Guava classes +-keep class com.google.common.** { *; } +-dontwarn com.google.common.** +-dontwarn com.google.android.play.core.** + +# Keep SLF4J and Logback classes +-keep class org.slf4j.** { *; } +-keep class ch.qos.logback.** { *; } +-dontwarn org.slf4j.** +-dontwarn ch.qos.logback.** + +# Missing Dependencies (Android doesn't have these) +-dontwarn javax.mail.** +-dontwarn javax.activation.** +-dontwarn javax.servlet.** + ##---------------End: proguard configuration ---------- diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index bd22a12..fc777bd 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -50,6 +50,8 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug + minifyEnabled true + shrinkResources false } } } @@ -59,5 +61,5 @@ flutter { } dependencies { - implementation 'com.android.support:multidex:1.0.3' + implementation 'com.android.support:multidex:2.0.0' } From 69a7edc984c815f53b2ee450aa238910e279f761 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 17:28:32 +0600 Subject: [PATCH 2/9] chore: add minification compatibility test workflow - Add workflow for testing minification compatibility - Set up Flutter and Java environments - Install dependencies and create ProGuard rules - Test with minification enabled and disabled - Run unit tests and verify APK artifacts - Check for ProGuard/R8 artifacts and upload APKs - Report test results and clean up temporary files --- .github/workflows/flutter.yml | 158 ++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index fe24b49..41a8a3a 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -171,3 +171,161 @@ jobs: architecture: x64 - run: flutter pub get - run: flutter test + + # Minification Compatibility Test + minification_compatibility_test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + cache: true + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Install dependencies + run: | + flutter pub get + cd example && flutter pub get + + - name: Create ProGuard rules for example app + run: | + cat > example/android/app/proguard-rules.pro << 'EOF' + # Example app ProGuard rules for minification testing + + # Keep example app classes + -keep class com.optimizely.optimizely_flutter_sdk_example.** { *; } + + # Keep Flutter classes + -keep class io.flutter.app.** { *; } + -keep class io.flutter.plugins.GeneratedPluginRegistrant { *; } + + # Google Play Core (for Flutter engine) + -keep class com.google.android.play.core.** { *; } + -dontwarn com.google.android.play.core.** + + # Additional safety for Optimizely (redundant but safe) + -keep class com.optimizely.** { *; } + -dontwarn com.optimizely.** + + # Jackson JSON + -keep class com.fasterxml.jackson.** { *; } + -dontwarn com.fasterxml.jackson.** + + # Ignore missing classes + -dontwarn javax.mail.** + -dontwarn javax.activation.** + EOF + + - name: Test with minification ENABLED + run: | + echo "๐Ÿงช Testing with minifyEnabled = true" + + # Backup original build.gradle + cp example/android/app/build.gradle example/android/app/build.gradle.backup + + # Enable minification and ensure ProGuard rules are referenced + sed -i 's/minifyEnabled false/minifyEnabled true/' example/android/app/build.gradle + sed -i 's/shrinkResources false/shrinkResources true/' example/android/app/build.gradle + + # Ensure ProGuard rules are applied + if ! grep -q "proguardFiles.*proguard-rules.pro" example/android/app/build.gradle; then + sed -i '/minifyEnabled true/a\ proguardFiles getDefaultProguardFile('\''proguard-android-optimize.txt'\''), '\''proguard-rules.pro'\''' example/android/app/build.gradle + fi + + echo "๐Ÿ“„ Build configuration with minification:" + grep -A 5 "buildTypes" example/android/app/build.gradle + + # Build release APK + cd example + flutter build apk --release --verbose + + echo "โœ… Build successful with minification ENABLED" + + - name: Test with minification DISABLED + run: | + echo "๐Ÿงช Testing with minifyEnabled = false" + + # Restore original and disable minification + cp example/android/app/build.gradle.backup example/android/app/build.gradle + sed -i 's/minifyEnabled true/minifyEnabled false/' example/android/app/build.gradle + sed -i 's/shrinkResources true/shrinkResources false/' example/android/app/build.gradle + + echo "๐Ÿ“„ Build configuration without minification:" + grep -A 5 "buildTypes" example/android/app/build.gradle + + # Clean and build again + cd example + flutter clean + flutter build apk --release --verbose + + echo "โœ… Build successful with minification DISABLED" + + - name: Run unit tests + run: | + echo "๐Ÿงช Running unit tests to verify SDK functionality" + flutter test + + - name: Verify APK artifacts + run: | + echo "๐Ÿ“ฑ Checking APK files were created:" + ls -la example/build/app/outputs/apk/release/ + + # Check APK size + if [ -f "example/build/app/outputs/apk/release/app-release.apk" ]; then + APK_SIZE=$(stat -c%s example/build/app/outputs/apk/release/app-release.apk 2>/dev/null || stat -f%z example/build/app/outputs/apk/release/app-release.apk) + echo "๐Ÿ“Š Final APK Size: $(($APK_SIZE / 1024 / 1024)) MB" + fi + + - name: Check for ProGuard artifacts + run: | + echo "๐Ÿ” Checking for ProGuard/R8 artifacts:" + + # Look for mapping files + if [ -f "example/build/app/outputs/mapping/release/mapping.txt" ]; then + echo "โœ… ProGuard mapping file found" + echo "๐Ÿ“„ Mapping file size: $(wc -l < example/build/app/outputs/mapping/release/mapping.txt) lines" + else + echo "โ„น๏ธ No mapping file found (expected if minification was disabled)" + fi + + - name: Upload APK artifacts + uses: actions/upload-artifact@v3 + with: + name: minification-test-apk + path: | + example/build/app/outputs/apk/release/app-release.apk + example/build/app/outputs/mapping/release/mapping.txt + retention-days: 7 + + - name: Report test results + run: | + echo "๐ŸŽ‰ Minification compatibility test completed successfully!" + echo "โœ… minifyEnabled = true: PASSED" + echo "โœ… minifyEnabled = false: PASSED" + echo "โœ… Your Optimizely Flutter SDK is minification-compatible!" + echo "" + echo "This confirms that:" + echo " โ€ข Library ProGuard rules are working correctly" + echo " โ€ข Plugin registration survives minification" + echo " โ€ข No critical classes are being stripped" + echo " โ€ข Customer's issue should be resolved" + + - name: Cleanup + if: always() + run: | + # Restore original build.gradle if backup exists + if [ -f "example/android/app/build.gradle.backup" ]; then + mv example/android/app/build.gradle.backup example/android/app/build.gradle + echo "โœ… Restored original build.gradle" + fi From f16c3645eb3b975d14fe1127e910f06810558b31 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 17:31:21 +0600 Subject: [PATCH 3/9] ci: upgrade upload-artifact action to v4 - Update 'actions/upload-artifact' action version from v3 to v4 for workflow optimization and compatibility. --- .github/workflows/flutter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 41a8a3a..6c4a1f5 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -300,7 +300,7 @@ jobs: fi - name: Upload APK artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: minification-test-apk path: | From 71a352d022463d469863380c51abad1baaae9c90 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 17:42:03 +0600 Subject: [PATCH 4/9] ci: add minification compatibility test workflow - Implement a CI workflow for testing minification compatibility - Include job for testing with minification enabled and disabled - Add steps for verifying APK artifacts and ProGuard files - Include uploading APK artifacts and reporting test results --- .github/workflows/flutter.yml | 160 +-------------------------- .github/workflows/minification.yml | 166 +++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 159 deletions(-) create mode 100644 .github/workflows/minification.yml diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 6c4a1f5..ffcce73 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -170,162 +170,4 @@ jobs: channel: 'stable' architecture: x64 - run: flutter pub get - - run: flutter test - - # Minification Compatibility Test - minification_compatibility_test: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - architecture: x64 - cache: true - - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - - - name: Install dependencies - run: | - flutter pub get - cd example && flutter pub get - - - name: Create ProGuard rules for example app - run: | - cat > example/android/app/proguard-rules.pro << 'EOF' - # Example app ProGuard rules for minification testing - - # Keep example app classes - -keep class com.optimizely.optimizely_flutter_sdk_example.** { *; } - - # Keep Flutter classes - -keep class io.flutter.app.** { *; } - -keep class io.flutter.plugins.GeneratedPluginRegistrant { *; } - - # Google Play Core (for Flutter engine) - -keep class com.google.android.play.core.** { *; } - -dontwarn com.google.android.play.core.** - - # Additional safety for Optimizely (redundant but safe) - -keep class com.optimizely.** { *; } - -dontwarn com.optimizely.** - - # Jackson JSON - -keep class com.fasterxml.jackson.** { *; } - -dontwarn com.fasterxml.jackson.** - - # Ignore missing classes - -dontwarn javax.mail.** - -dontwarn javax.activation.** - EOF - - - name: Test with minification ENABLED - run: | - echo "๐Ÿงช Testing with minifyEnabled = true" - - # Backup original build.gradle - cp example/android/app/build.gradle example/android/app/build.gradle.backup - - # Enable minification and ensure ProGuard rules are referenced - sed -i 's/minifyEnabled false/minifyEnabled true/' example/android/app/build.gradle - sed -i 's/shrinkResources false/shrinkResources true/' example/android/app/build.gradle - - # Ensure ProGuard rules are applied - if ! grep -q "proguardFiles.*proguard-rules.pro" example/android/app/build.gradle; then - sed -i '/minifyEnabled true/a\ proguardFiles getDefaultProguardFile('\''proguard-android-optimize.txt'\''), '\''proguard-rules.pro'\''' example/android/app/build.gradle - fi - - echo "๐Ÿ“„ Build configuration with minification:" - grep -A 5 "buildTypes" example/android/app/build.gradle - - # Build release APK - cd example - flutter build apk --release --verbose - - echo "โœ… Build successful with minification ENABLED" - - - name: Test with minification DISABLED - run: | - echo "๐Ÿงช Testing with minifyEnabled = false" - - # Restore original and disable minification - cp example/android/app/build.gradle.backup example/android/app/build.gradle - sed -i 's/minifyEnabled true/minifyEnabled false/' example/android/app/build.gradle - sed -i 's/shrinkResources true/shrinkResources false/' example/android/app/build.gradle - - echo "๐Ÿ“„ Build configuration without minification:" - grep -A 5 "buildTypes" example/android/app/build.gradle - - # Clean and build again - cd example - flutter clean - flutter build apk --release --verbose - - echo "โœ… Build successful with minification DISABLED" - - - name: Run unit tests - run: | - echo "๐Ÿงช Running unit tests to verify SDK functionality" - flutter test - - - name: Verify APK artifacts - run: | - echo "๐Ÿ“ฑ Checking APK files were created:" - ls -la example/build/app/outputs/apk/release/ - - # Check APK size - if [ -f "example/build/app/outputs/apk/release/app-release.apk" ]; then - APK_SIZE=$(stat -c%s example/build/app/outputs/apk/release/app-release.apk 2>/dev/null || stat -f%z example/build/app/outputs/apk/release/app-release.apk) - echo "๐Ÿ“Š Final APK Size: $(($APK_SIZE / 1024 / 1024)) MB" - fi - - - name: Check for ProGuard artifacts - run: | - echo "๐Ÿ” Checking for ProGuard/R8 artifacts:" - - # Look for mapping files - if [ -f "example/build/app/outputs/mapping/release/mapping.txt" ]; then - echo "โœ… ProGuard mapping file found" - echo "๐Ÿ“„ Mapping file size: $(wc -l < example/build/app/outputs/mapping/release/mapping.txt) lines" - else - echo "โ„น๏ธ No mapping file found (expected if minification was disabled)" - fi - - - name: Upload APK artifacts - uses: actions/upload-artifact@v4 - with: - name: minification-test-apk - path: | - example/build/app/outputs/apk/release/app-release.apk - example/build/app/outputs/mapping/release/mapping.txt - retention-days: 7 - - - name: Report test results - run: | - echo "๐ŸŽ‰ Minification compatibility test completed successfully!" - echo "โœ… minifyEnabled = true: PASSED" - echo "โœ… minifyEnabled = false: PASSED" - echo "โœ… Your Optimizely Flutter SDK is minification-compatible!" - echo "" - echo "This confirms that:" - echo " โ€ข Library ProGuard rules are working correctly" - echo " โ€ข Plugin registration survives minification" - echo " โ€ข No critical classes are being stripped" - echo " โ€ข Customer's issue should be resolved" - - - name: Cleanup - if: always() - run: | - # Restore original build.gradle if backup exists - if [ -f "example/android/app/build.gradle.backup" ]; then - mv example/android/app/build.gradle.backup example/android/app/build.gradle - echo "โœ… Restored original build.gradle" - fi + - run: flutter test \ No newline at end of file diff --git a/.github/workflows/minification.yml b/.github/workflows/minification.yml new file mode 100644 index 0000000..de2d35f --- /dev/null +++ b/.github/workflows/minification.yml @@ -0,0 +1,166 @@ +name: Minification Compatibility Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: # Allow manual triggering + +jobs: + minification_compatibility_test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + cache: true + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Install dependencies + run: | + flutter pub get + cd example && flutter pub get + + - name: Create ProGuard rules for example app + run: | + cat > example/android/app/proguard-rules.pro << 'EOF' + # Example app ProGuard rules for minification testing + + # Keep example app classes + -keep class com.optimizely.optimizely_flutter_sdk_example.** { *; } + + # Keep Flutter classes + -keep class io.flutter.app.** { *; } + -keep class io.flutter.plugins.GeneratedPluginRegistrant { *; } + + # Google Play Core (for Flutter engine) + -keep class com.google.android.play.core.** { *; } + -dontwarn com.google.android.play.core.** + + # Additional safety for Optimizely (redundant but safe) + -keep class com.optimizely.** { *; } + -dontwarn com.optimizely.** + + # Jackson JSON + -keep class com.fasterxml.jackson.** { *; } + -dontwarn com.fasterxml.jackson.** + + # Ignore missing classes + -dontwarn javax.mail.** + -dontwarn javax.activation.** + EOF + + - name: Test with minification ENABLED + run: | + echo "๐Ÿงช Testing with minifyEnabled = true" + + # Backup original build.gradle + cp example/android/app/build.gradle example/android/app/build.gradle.backup + + # Enable minification and ensure ProGuard rules are referenced + sed -i 's/minifyEnabled false/minifyEnabled true/' example/android/app/build.gradle + sed -i 's/shrinkResources false/shrinkResources true/' example/android/app/build.gradle + + # Ensure ProGuard rules are applied + if ! grep -q "proguardFiles.*proguard-rules.pro" example/android/app/build.gradle; then + sed -i '/minifyEnabled true/a\ proguardFiles getDefaultProguardFile('\''proguard-android-optimize.txt'\''), '\''proguard-rules.pro'\''' example/android/app/build.gradle + fi + + echo "๐Ÿ“„ Build configuration with minification:" + grep -A 5 "buildTypes" example/android/app/build.gradle + + # Build release APK + cd example + flutter build apk --release + + echo "โœ… Build successful with minification ENABLED" + + - name: Test with minification DISABLED + run: | + echo "๐Ÿงช Testing with minifyEnabled = false" + + # Restore original and disable minification + cp example/android/app/build.gradle.backup example/android/app/build.gradle + sed -i 's/minifyEnabled true/minifyEnabled false/' example/android/app/build.gradle + sed -i 's/shrinkResources true/shrinkResources false/' example/android/app/build.gradle + + echo "๐Ÿ“„ Build configuration without minification:" + grep -A 5 "buildTypes" example/android/app/build.gradle + + # Clean and build again + cd example + flutter clean + flutter build apk --release + + echo "โœ… Build successful with minification DISABLED" + + - name: Run unit tests + run: | + echo "๐Ÿงช Running unit tests to verify SDK functionality" + flutter test + + - name: Verify APK artifacts + run: | + echo "๐Ÿ“ฑ Checking APK files were created:" + ls -la example/build/app/outputs/apk/release/ + + # Check APK size + if [ -f "example/build/app/outputs/apk/release/app-release.apk" ]; then + APK_SIZE=$(stat -c%s example/build/app/outputs/apk/release/app-release.apk 2>/dev/null || stat -f%z example/build/app/outputs/apk/release/app-release.apk) + echo "๐Ÿ“Š Final APK Size: $(($APK_SIZE / 1024 / 1024)) MB" + fi + + - name: Check for ProGuard artifacts + run: | + echo "๐Ÿ” Checking for ProGuard/R8 artifacts:" + + # Look for mapping files + if [ -f "example/build/app/outputs/mapping/release/mapping.txt" ]; then + echo "โœ… ProGuard mapping file found" + echo "๐Ÿ“„ Mapping file size: $(wc -l < example/build/app/outputs/mapping/release/mapping.txt) lines" + else + echo "โ„น๏ธ No mapping file found (expected if minification was disabled)" + fi + + - name: Upload APK artifacts + uses: actions/upload-artifact@v4 + with: + name: minification-test-apk + path: | + example/build/app/outputs/apk/release/app-release.apk + example/build/app/outputs/mapping/release/mapping.txt + retention-days: 7 + + - name: Report test results + run: | + echo "๐ŸŽ‰ Minification compatibility test completed successfully!" + echo "โœ… minifyEnabled = true: PASSED" + echo "โœ… minifyEnabled = false: PASSED" + echo "โœ… Your Optimizely Flutter SDK is minification-compatible!" + echo "" + echo "This confirms that:" + echo " โ€ข Library ProGuard rules are working correctly" + echo " โ€ข Plugin registration survives minification" + echo " โ€ข No critical classes are being stripped" + echo " โ€ข Customer's issue should be resolved" + + - name: Cleanup + if: always() + run: | + # Restore original build.gradle if backup exists + if [ -f "example/android/app/build.gradle.backup" ]; then + mv example/android/app/build.gradle.backup example/android/app/build.gradle + echo "โœ… Restored original build.gradle" + fi \ No newline at end of file From 157fb27fc26c4a3c589087e404305a9b0c4362e2 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 17:50:07 +0600 Subject: [PATCH 5/9] chore: update CI workflow for minification compatibility test - Update Gradle JVM and Android build options - Ensure minification is enabled - Build for single architecture to optimize memory - Refactor script for APK artifact verification - Simplify test execution line - Improve output messages for various tasks --- .github/workflows/minification.yml | 70 ++++++++++++++++-------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/.github/workflows/minification.yml b/.github/workflows/minification.yml index de2d35f..8a9827f 100644 --- a/.github/workflows/minification.yml +++ b/.github/workflows/minification.yml @@ -5,7 +5,7 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] - workflow_dispatch: # Allow manual triggering + workflow_dispatch: jobs: minification_compatibility_test: @@ -28,6 +28,29 @@ jobs: distribution: 'temurin' java-version: '17' + - name: Configure Gradle JVM options + run: | + mkdir -p ~/.gradle + cat > ~/.gradle/gradle.properties << 'EOF' + # Increase heap size for CI builds + org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError + org.gradle.daemon=true + org.gradle.parallel=true + org.gradle.configureondemand=true + android.enableJetifier=true + android.useAndroidX=true + EOF + + - name: Configure Android build options + run: | + cat >> example/android/gradle.properties << 'EOF' + + # Memory optimization for CI + org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m + android.enableJetifier=true + android.useAndroidX=true + EOF + - name: Install dependencies run: | flutter pub get @@ -49,7 +72,7 @@ jobs: -keep class com.google.android.play.core.** { *; } -dontwarn com.google.android.play.core.** - # Additional safety for Optimizely (redundant but safe) + # Additional safety for Optimizely -keep class com.optimizely.** { *; } -dontwarn com.optimizely.** @@ -69,7 +92,7 @@ jobs: # Backup original build.gradle cp example/android/app/build.gradle example/android/app/build.gradle.backup - # Enable minification and ensure ProGuard rules are referenced + # Enable minification sed -i 's/minifyEnabled false/minifyEnabled true/' example/android/app/build.gradle sed -i 's/shrinkResources false/shrinkResources true/' example/android/app/build.gradle @@ -81,9 +104,9 @@ jobs: echo "๐Ÿ“„ Build configuration with minification:" grep -A 5 "buildTypes" example/android/app/build.gradle - # Build release APK + # Build for single architecture to save memory cd example - flutter build apk --release + flutter build apk --release --target-platform android-arm64 --split-per-abi echo "โœ… Build successful with minification ENABLED" @@ -91,7 +114,7 @@ jobs: run: | echo "๐Ÿงช Testing with minifyEnabled = false" - # Restore original and disable minification + # Restore original cp example/android/app/build.gradle.backup example/android/app/build.gradle sed -i 's/minifyEnabled true/minifyEnabled false/' example/android/app/build.gradle sed -i 's/shrinkResources true/shrinkResources false/' example/android/app/build.gradle @@ -99,39 +122,29 @@ jobs: echo "๐Ÿ“„ Build configuration without minification:" grep -A 5 "buildTypes" example/android/app/build.gradle - # Clean and build again + # Clean and build cd example flutter clean - flutter build apk --release + flutter build apk --release --target-platform android-arm64 --split-per-abi echo "โœ… Build successful with minification DISABLED" - name: Run unit tests - run: | - echo "๐Ÿงช Running unit tests to verify SDK functionality" - flutter test + run: flutter test - name: Verify APK artifacts run: | - echo "๐Ÿ“ฑ Checking APK files were created:" - ls -la example/build/app/outputs/apk/release/ - - # Check APK size - if [ -f "example/build/app/outputs/apk/release/app-release.apk" ]; then - APK_SIZE=$(stat -c%s example/build/app/outputs/apk/release/app-release.apk 2>/dev/null || stat -f%z example/build/app/outputs/apk/release/app-release.apk) - echo "๐Ÿ“Š Final APK Size: $(($APK_SIZE / 1024 / 1024)) MB" - fi + echo "๐Ÿ“ฑ Checking APK files:" + find example/build/app/outputs/apk/ -name "*.apk" -exec ls -la {} \; - name: Check for ProGuard artifacts run: | echo "๐Ÿ” Checking for ProGuard/R8 artifacts:" - - # Look for mapping files if [ -f "example/build/app/outputs/mapping/release/mapping.txt" ]; then echo "โœ… ProGuard mapping file found" echo "๐Ÿ“„ Mapping file size: $(wc -l < example/build/app/outputs/mapping/release/mapping.txt) lines" else - echo "โ„น๏ธ No mapping file found (expected if minification was disabled)" + echo "โ„น๏ธ No mapping file found" fi - name: Upload APK artifacts @@ -139,27 +152,20 @@ jobs: with: name: minification-test-apk path: | - example/build/app/outputs/apk/release/app-release.apk + example/build/app/outputs/apk/release/*.apk example/build/app/outputs/mapping/release/mapping.txt retention-days: 7 - name: Report test results run: | - echo "๐ŸŽ‰ Minification compatibility test completed successfully!" + echo "๐ŸŽ‰ Minification compatibility test completed!" echo "โœ… minifyEnabled = true: PASSED" echo "โœ… minifyEnabled = false: PASSED" - echo "โœ… Your Optimizely Flutter SDK is minification-compatible!" - echo "" - echo "This confirms that:" - echo " โ€ข Library ProGuard rules are working correctly" - echo " โ€ข Plugin registration survives minification" - echo " โ€ข No critical classes are being stripped" - echo " โ€ข Customer's issue should be resolved" + echo "โœ… Memory optimizations applied successfully" - name: Cleanup if: always() run: | - # Restore original build.gradle if backup exists if [ -f "example/android/app/build.gradle.backup" ]; then mv example/android/app/build.gradle.backup example/android/app/build.gradle echo "โœ… Restored original build.gradle" From 2b3394837542e34bf7781fae335016983867bbce Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 18:22:28 +0600 Subject: [PATCH 6/9] fix: update Java version to '11' in setup - Update the Java version in the setup to '11' in minification workflow --- .github/workflows/minification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/minification.yml b/.github/workflows/minification.yml index 8a9827f..42205f2 100644 --- a/.github/workflows/minification.yml +++ b/.github/workflows/minification.yml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '17' + java-version: '11' - name: Configure Gradle JVM options run: | From 925ae0408f70d9616f3d8e9cb868318ab5f41fe2 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 18:24:45 +0600 Subject: [PATCH 7/9] fix: remove minifyEnabled and shrinkResources from release build configuration - Update release build configuration in build.gradle - Remove minifyEnabled and shrinkResources settings from release build configuration --- example/android/app/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fc777bd..21cea4c 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -50,8 +50,6 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug - minifyEnabled true - shrinkResources false } } } From 0868921bf1c910c2bc623152e96a8152ea2ad971 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 18:31:30 +0600 Subject: [PATCH 8/9] build: update Java version to 17 - Update Java version in the minification workflow from 11 to 17 --- .github/workflows/minification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/minification.yml b/.github/workflows/minification.yml index 42205f2..8a9827f 100644 --- a/.github/workflows/minification.yml +++ b/.github/workflows/minification.yml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Configure Gradle JVM options run: | From 2507f36908fc1d5fb71e740530aacbd20cc42604 Mon Sep 17 00:00:00 2001 From: muzahidul-opti Date: Tue, 7 Oct 2025 23:07:59 +0600 Subject: [PATCH 9/9] chore: update minification and ProGuard rules - Remove additional safety rules for Optimizely - Update APK artifacts upload path for minification test - Remove unnecessary Guava classes and warnings - Adjust SLF4J and Logback rules for ProGuard - Remove warnings for missing dependencies in ProGuard configuration --- .github/workflows/minification.yml | 13 ------------- android/proguard-rules.txt | 17 ----------------- 2 files changed, 30 deletions(-) diff --git a/.github/workflows/minification.yml b/.github/workflows/minification.yml index 8a9827f..bd3db11 100644 --- a/.github/workflows/minification.yml +++ b/.github/workflows/minification.yml @@ -72,10 +72,6 @@ jobs: -keep class com.google.android.play.core.** { *; } -dontwarn com.google.android.play.core.** - # Additional safety for Optimizely - -keep class com.optimizely.** { *; } - -dontwarn com.optimizely.** - # Jackson JSON -keep class com.fasterxml.jackson.** { *; } -dontwarn com.fasterxml.jackson.** @@ -147,15 +143,6 @@ jobs: echo "โ„น๏ธ No mapping file found" fi - - name: Upload APK artifacts - uses: actions/upload-artifact@v4 - with: - name: minification-test-apk - path: | - example/build/app/outputs/apk/release/*.apk - example/build/app/outputs/mapping/release/mapping.txt - retention-days: 7 - - name: Report test results run: | echo "๐ŸŽ‰ Minification compatibility test completed!" diff --git a/android/proguard-rules.txt b/android/proguard-rules.txt index 26933ae..b3914f4 100644 --- a/android/proguard-rules.txt +++ b/android/proguard-rules.txt @@ -8,28 +8,11 @@ # Add any project specific keep options here: # Optimizely --keep class com.optimizely.optimizely_flutter_sdk.OptimizelyFlutterSdkPlugin { *; } -keep class com.optimizely.optimizely_flutter_sdk.** { *; } --keep class com.optimizely.ab.** { *; } # Keep Jackson classes for JSON parsing -keep class com.fasterxml.jackson.** { *; } -dontwarn com.fasterxml.jackson.** -# Keep Guava classes --keep class com.google.common.** { *; } --dontwarn com.google.common.** --dontwarn com.google.android.play.core.** - -# Keep SLF4J and Logback classes --keep class org.slf4j.** { *; } --keep class ch.qos.logback.** { *; } --dontwarn org.slf4j.** --dontwarn ch.qos.logback.** - -# Missing Dependencies (Android doesn't have these) --dontwarn javax.mail.** --dontwarn javax.activation.** --dontwarn javax.servlet.** ##---------------End: proguard configuration ----------