Skip to content

Comments

Move task operations out of onVariants to fix AGP Artifacts API confl…#5690

Draft
RyanCommits wants to merge 1 commit intogetsentry:mainfrom
RyanCommits:fix/gradle-onvariants-task-realization
Draft

Move task operations out of onVariants to fix AGP Artifacts API confl…#5690
RyanCommits wants to merge 1 commit intogetsentry:mainfrom
RyanCommits:fix/gradle-onvariants-task-realization

Conversation

@RyanCommits
Copy link

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Fixes issue where calling tasks.matching{}.each{} inside androidComponents.onVariants()
forces task realization during AGP's variant configuration phase, disrupting the
Artifacts API transform chain used by other plugins (e.g. Fullstory).

This caused APK transforms from other plugins to output to build/intermediates/
instead of build/outputs/, breaking downstream tooling that expects APKs in the
standard location.

The fix:

  • Collect only variant metadata (name, outputs) in onVariants callback
  • Move all task-level operations (tasks.matching, tasks.register, etc.) into
    project.afterEvaluate within the plugins.withId block
  • Update extractCurrentVariants to accept pre-collected data instead of live variant

This ensures the AGP Artifacts API transform chain is fully established before
Sentry accesses any tasks, preventing interference with other plugins.

💡 Motivation and Context

This is currently conflicting with the Fullstory plugin

💚 How did you test it?

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • Move task operations out of onVariants to fix AGP Artifacts API confl… by RyanCommits in #5690

🤖 This preview updates automatically when you update the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant