[video_player_android] Enable -Werror and use dependency override (#3412)

[video_player_android] Enable -Werror and use dependency override
diff --git a/packages/video_player/video_player_android/CHANGELOG.md b/packages/video_player/video_player_android/CHANGELOG.md
index 86c83e5..b9322e6 100644
--- a/packages/video_player/video_player_android/CHANGELOG.md
+++ b/packages/video_player/video_player_android/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.4.1
+
+* Changes the severity of `javac` warnings so that they are treated as errors and fixes the violations.
+
 ## 2.4.0
 
 * Allows setting the ExoPlayer user agent by passing a User-Agent HTTP header.
diff --git a/packages/video_player/video_player_android/example/android/build.gradle b/packages/video_player/video_player_android/example/android/build.gradle
index 4851ea6..8b48cc8 100644
--- a/packages/video_player/video_player_android/example/android/build.gradle
+++ b/packages/video_player/video_player_android/example/android/build.gradle
@@ -35,9 +35,30 @@
 gradle.projectsEvaluated {
     project(":video_player_android") {
         tasks.withType(JavaCompile) {
-            // TODO(stuartmorgan): Enable this. See
-            // https://github.com/flutter/flutter/issues/91868
-            //options.compilerArgs << "-Xlint:all" << "-Werror"
+            options.compilerArgs << "-Xlint:all" << "-Werror"
+
+            // Workaround for several warnings when building
+            // that the above turns into errors, coming from
+            // org.checkerframework.checker.nullness.qual and 
+            // com.google.errorprone.annotations:
+            // 
+            //   warning: Cannot find annotation method 'value()' in type
+            //   'EnsuresNonNull': class file for
+            //   org.checkerframework.checker.nullness.qual.EnsuresNonNull not found
+            //
+            //   warning: Cannot find annotation method 'replacement()' in type
+            //   'InlineMe': class file for
+            //   com.google.errorprone.annotations.InlineMe not found
+            //
+            // The dependency version are taken from:
+            // https://github.com/google/ExoPlayer/blob/r2.18.1/constants.gradle
+            //
+            // For future reference the dependencies are excluded here:
+            // https://github.com/google/ExoPlayer/blob/r2.18.1/library/common/build.gradle#L33-L34
+            dependencies {
+                implementation "org.checkerframework:checker-qual:3.13.0"
+                implementation "com.google.errorprone:error_prone_annotations:2.10.0"
+            }
         }
     }
 }
diff --git a/packages/video_player/video_player_android/pubspec.yaml b/packages/video_player/video_player_android/pubspec.yaml
index 03307eb..ae383b4 100644
--- a/packages/video_player/video_player_android/pubspec.yaml
+++ b/packages/video_player/video_player_android/pubspec.yaml
@@ -2,7 +2,7 @@
 description: Android implementation of the video_player plugin.
 repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
-version: 2.4.0
+version: 2.4.1
 
 environment:
   sdk: ">=2.17.0 <3.0.0"