Ensure Java 8 (#4058)

diff --git a/.ci/java8.Dockerfile b/.ci/java8.Dockerfile
new file mode 100644
index 0000000..fb1844a
--- /dev/null
+++ b/.ci/java8.Dockerfile
@@ -0,0 +1,33 @@
+FROM cirrusci/flutter:stable
+
+RUN apt-get update -y
+
+# Required by Roboeletric and the Android SDK.
+RUN apt-get install -y openjdk-8-jdk
+ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+
+RUN apt-get install -y --no-install-recommends gnupg
+
+# Add repo for gcloud sdk and install it
+RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \
+    tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
+
+RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
+    apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
+
+RUN apt-get update && apt-get install -y google-cloud-sdk && \
+    gcloud config set core/disable_usage_reporting true && \
+    gcloud config set component_manager/disable_update_check true
+
+RUN yes | sdkmanager \
+    "platforms;android-27" \
+    "build-tools;27.0.3" \
+    "extras;google;m2repository" \
+    "extras;android;m2repository"
+
+RUN yes | sdkmanager --licenses
+
+# Install formatter.
+RUN apt-get install -y clang-format
+# Required by Roboeletric and the Android SDK.
+RUN apt-get install -y openjdk-8-jdk
diff --git a/.cirrus.yml b/.cirrus.yml
index 210a98b..dcec7bc 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -112,13 +112,17 @@
       drive_script:
         - xvfb-run ./script/tool_runner.sh drive-examples --linux
 
-# Heavy-workload Linux tasks.
+# Heavy-workload Android tasks.
 # These use machines with more CPUs and memory, so will reduce parallelization
 # for non-credit runs.
+#
+# This has been temporarily split out from the other heavy tasks to use a
+# different Docker image due to space constraints; see
+# https://github.com/flutter/flutter/issues/84706
 task:
   << : *FLUTTER_UPGRADE_TEMPLATE
   gke_container:
-    dockerfile: .ci/Dockerfile
+    dockerfile: .ci/java8.Dockerfile
     builder_image_name: docker-builder # gce vm image
     builder_image_project: flutter-cirrus
     cluster_name: test-cluster
@@ -161,6 +165,22 @@
         - fi
         - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt`
         - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt`
+
+# Heavy-workload web tasks.
+# These use machines with more CPUs and memory, so will reduce parallelization
+# for non-credit runs.
+task:
+  << : *FLUTTER_UPGRADE_TEMPLATE
+  gke_container:
+    dockerfile: .ci/Dockerfile
+    builder_image_name: docker-builder # gce vm image
+    builder_image_project: flutter-cirrus
+    cluster_name: test-cluster
+    zone: us-central1-a
+    namespace: default
+    cpu: 4
+    memory: 12G
+  matrix:
     ### Web tasks ###
     - name: build-web+drive-examples
       env: