Skip to content

Adds Empty Error View from Release builds on Android - #1494

Open
LTPhantom wants to merge 2 commits into
mainfrom
errorViewFix
Open

LTPhantom wants to merge 2 commits into
mainfrom
errorViewFix

Conversation

@LTPhantom

@LTPhantom LTPhantom commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Fix Android platform view resize error when ErrorView is displayed in release mode for Android builds.

Related Issues

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@LTPhantom
LTPhantom marked this pull request as ready for review September 7, 2026 23:22
}

@Test
public void create_withUnknownAdId_returnsConsistentView() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is debug mode enabled during unit tests? If yes, this may not be testing the new code you added, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! You are completely right! Unit tests run against the debug build variant so EmptyPlatformView wasn't being directly tested.

I've made EmptyPlatformView package-private and added a dedicated unit test to directly verify that EmptyPlatformView consistently returns the same View reference across getView() calls.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the change.

The test names sound misleading in the case of null args, unknown Ad ID and null platform view. The intention is to return an empty view, right? I think you can replace "ConsistentView" with "EmptyView".

}

@Test
public void create_withUnknownAdId_returnsConsistentView() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the change.

The test names sound misleading in the case of null args, unknown Ad ID and null platform view. The intention is to return an empty view, right? I think you can replace "ConsistentView" with "EmptyView".

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.

getErrorView() returns a new View on every getView() call, breaking platform view resize (LayoutParams NPE)

3 participants