-
Notifications
You must be signed in to change notification settings - Fork 8
Description
🧾 Summary: Integration Issues with Pollfish Flutter Plugin
🔧 Setup Environment
• Flutter version: 3.29.2 (stable)
• Android Gradle Plugin (AGP): 8.1.4
• Gradle version: 8+
• JDK: OpenJDK 17
• Flutter plugin integration: via flutter_pollfish using local path: ../flutter-plugin-pollfish
• Target platform: Android only (iOS not yet tested)
⸻
❌ Issue 1: Cannot run Project.afterEvaluate(Closure) when the project is already evaluated
❓What it means:
Flutter’s new flutter-gradle-plugin finalizes the Gradle project configuration earlier than before. If any plugin (or the app itself) tries to run afterEvaluate {} after evaluation has completed, the build fails immediately.
📍Where it occurs:
Failed to apply plugin 'dev.flutter.flutter-gradle-plugin'.
Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
📌 Relevance:
This happens even with no visible afterEvaluate block in our app/build.gradle or the plugin’s android/build.gradle. It appears to be triggered by using a local plugin that is not structured as a true Flutter plugin (i.e., no plugin registration in pubspec.yaml, no Dart API entrypoint).
⸻
❌ Issue 2: Plugin appears to be treated as a plain Gradle module, not a Flutter plugin
📍Why that’s a problem:
The plugin:
• Has no flutter.plugin block in pubspec.yaml
• Has no lib/flutter_pollfish.dart entrypoint
• Contains only native Android logic and an .aar file
• Triggers errors in Flutter’s plugin loader when used via a local path: ../flutter-plugin-pollfish
⸻
❌ Issue 3: .aar loading works only if configuration is perfect
Even when bypassing the above issue, loading the .aar via:
implementation(name: 'pollfish-android-sdk-6.5.0', ext: 'aar')
requires:
• libs/ folder in the plugin’s android/ directory
• flatDir configuration in repositories {}
• No premature evaluation of project.android
This introduces a fragile dependency chain prone to version mismatches.
⸻
✅ Temporary Workarounds
We tried the following workarounds:
• Using the public GitHub version of flutter-plugin-pollfish (fails due to missing namespace for AGP 8+)
• Forking and patching the plugin (build.gradle, namespace, plugin DSL)
• Removing all afterEvaluate hooks
• Downgrading JDKs and cleaning all Gradle caches
• Removing the plugin from pubspec.yaml entirely — still triggers residual configuration errors, likely due to Flutter’s plugin resolution behavior with local modules
⸻
🔍 What We Need from Pollfish
1. An updated flutter-plugin-pollfish that complies with Flutter 3.13+ and AGP 8+:
• Add a valid plugin declaration in pubspec.yaml
• Provide a stub lib/flutter_pollfish.dart file to satisfy the Flutter toolchain
• Avoid using afterEvaluate {} in any build scripts
• Publish the Pollfish SDK to Maven Central or JitPack so we don’t need to manage .aar files manually
2. Example usage project with AGP 8+, Flutter 3.13+, and JDK 17 showing the plugin fully working
3. Official guidance on whether this plugin is intended for production use with the latest Flutter tooling, or if there’s an alternative SDK/integration path