Repository navigation
fix(android): fail the build when posthog-android would be raised to 4.x - #728
Closed
turnipdabeets wants to merge 1 commit into
Closed
turnipdabeets wants to merge 1 commit into
turnipdabeets wants to merge 1 commit into
Conversation
The plugin's posthog-android range was a plain range, so Gradle raised it to 4.0 when the app or another library asked for 4.x (for example core posthog 7.x or posthog-server 2.25). The plugin, compiled against 3.x, then crashed at runtime on APIs 4.0 removes. A strict range makes that a resolution error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
Contributor
posthog-flutter Compliance ReportDate: 2026-11-12 21:07:10 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
turnipdabeets
marked this pull request as ready for review
November 12, 2026 23:08
PR overviewNo security issues were found in this pull request. Reviews
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
posthog_flutter5.x declarescom.posthog:posthog-android:[3.75.0,4.0.0). A plain Gradle range isn't a ceiling: when anything else in the app asks for posthog-android 4.x, Gradle picks the highest version and the app ships posthog-android 4.0. The plugin is compiled in its own Gradle project against 3.x, so the build succeeds and the app crashes at runtime on APIs 4.0 removes, for examplePostHogOnFeatureFlagsduringPosthog().setupandRRStylein the replay snapshot path.Ways an app gets there once posthog-android 4.0 ships:
posthog-android:4.+,+or4.0.0com.posthog:posthog7.x orposthog-server2.25, whose Gradle metadata raises posthog-android to the matching major (fix: align posthog-android to core's major with a Gradle constraint posthog-android#974)This makes the range
strictly '[3.75.0,4.0.0)', so those builds fail at dependency resolution with Gradle's "Cannot find a version of 'com.posthog:posthog-android' that satisfies the version constraints", naming this plugin's dependency path, instead of crashing at runtime. Apps that only use the plugin resolve the same 3.x version as before.Only apps that update to this 5.x release get the check. posthog_flutter 6 gets the same change on its 4.x range in #729.
💚 How did you test it?
Locally, with posthog-android 4.0.0 and core 7.0.0 built from PostHog/posthog-android#871 and published to a scratch Maven repo, in a throwaway
flutter createapp on this branch's plugin (path dependency):com.posthog:posthog:7.0.0com.posthog:posthog-android:4.0.0flutter build apk --debuginexample/builds.:posthog_flutter:testDebugUnitTest: 75 tests, 0 failures.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (posthog_flutterpatch)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Claude Opus 5.5) found this while testing the posthog-android 4.0 release: a wrapper check showed the 5.x plugin builds next to core 7 and only fails at runtime.
strictlywas chosen over apreferpin so the plugin keeps picking up 3.x patch releases without edits. No added test: the behavior is Gradle dependency resolution in a consuming app, which the plugin's unit tests can't exercise.🤖 Generated with Claude Code