Skip to content

[webview_flutter_android] Build Error occured, fixed at line 89 and 200. #9012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.3.5

* Gradle debug build stopped because some line of codes considered errors.
* Putting same lambda in the removeCallbacks, it's not recognized as the same object and not removed.
* 2 lines of code fixed.

## 4.3.4

* Bumps gradle from 8.0.0 to 8.9.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class AndroidWebkitLibraryPigeonInstanceManager(
*/
var clearFinalizedWeakReferencesInterval: Long = 3000
set(value) {
handler.removeCallbacks { this.releaseAllFinalizedInstances() }
val runnable = Runnable { this.releaseAllFinalizedInstances() }
Copy link
Contributor

Choose a reason for hiding this comment

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

This is bypassing the warning rather than fixing what the warning is flagging, which is that this will not remove the listener added on line 96.

The goal with warnings is to address the cause of the warning, rather than to silence the warning without fixing the underlying problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

My Kotlin might be slightly off but I think the intended line should be:

handler.removeCallbacks(releaseAllFinalizedInstances)

And the Handler.postDelayed below needs to be updated as well.

handler.removeCallbacks(runnable)
field = value
releaseAllFinalizedInstances()
}
Expand Down Expand Up @@ -198,7 +199,8 @@ class AndroidWebkitLibraryPigeonInstanceManager(
* longer be called and methods will log a warning.
*/
fun stopFinalizationListener() {
handler.removeCallbacks { this.releaseAllFinalizedInstances() }
val runnable = Runnable { this.releaseAllFinalizedInstances() }
handler.removeCallbacks(runnable)
hasFinalizationListenerStopped = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_android
description: A Flutter plugin that provides a WebView widget on Android.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 4.3.4
version: 4.3.5

environment:
sdk: ^3.6.0
Expand Down