Upgrade Gradle in AGP to 8.7

Bug: 333721263
Test: n/a
Change-Id: Ief784ba6f2898c5d361b5689d3c7fe4443408408
diff --git a/bazel/maven/BUILD.maven b/bazel/maven/BUILD.maven
index 96e400a..be539ae 100644
--- a/bazel/maven/BUILD.maven
+++ b/bazel/maven/BUILD.maven
@@ -8384,12 +8384,12 @@
 )
 
 maven_artifact(
-    name = "org.gradle.gradle-tooling-api_8.6",
-    pom = "repository/org/gradle/gradle-tooling-api/8.6/gradle-tooling-api-8.6.pom",
+    name = "org.gradle.gradle-tooling-api_8.7",
+    pom = "repository/org/gradle/gradle-tooling-api/8.7/gradle-tooling-api-8.7.pom",
     repo_root_path = "repository",
-    repo_path = "org/gradle/gradle-tooling-api/8.6",
+    repo_path = "org/gradle/gradle-tooling-api/8.7",
     deps = [
-        "org.slf4j.slf4j-api_1.7.30",
+        "org.slf4j.slf4j-api_1.7.36",
     ],
     visibility = ["//visibility:public"],
 )
@@ -8398,17 +8398,17 @@
     name = "org.gradle.gradle-tooling-api",
     classifiers = [],
     jars = [
-        "repository/org/gradle/gradle-tooling-api/8.6/gradle-tooling-api-8.6.jar"
+        "repository/org/gradle/gradle-tooling-api/8.7/gradle-tooling-api-8.7.jar"
     ],
     exports = [
         "org.slf4j.slf4j-api",
     ],
     original_deps = [
-        "org.slf4j.slf4j-api_1.7.30",
+        "org.slf4j.slf4j-api_1.7.36",
     ],
-    pom = "repository/org/gradle/gradle-tooling-api/8.6/gradle-tooling-api-8.6.pom",
+    pom = "repository/org/gradle/gradle-tooling-api/8.7/gradle-tooling-api-8.7.pom",
     repo_root_path = "repository",
-    repo_path = "org/gradle/gradle-tooling-api/8.6",
+    repo_path = "org/gradle/gradle-tooling-api/8.7",
     visibility = ["//visibility:public"],
 )
 
@@ -11155,25 +11155,25 @@
 )
 
 maven_artifact(
-    name = "org.slf4j.slf4j-api_1.7.32",
-    pom = "repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.pom",
+    name = "org.slf4j.slf4j-api_1.7.36",
+    pom = "repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
     repo_root_path = "repository",
-    repo_path = "org/slf4j/slf4j-api/1.7.32",
-    parent = "org.slf4j.slf4j-parent_1.7.32",
+    repo_path = "org/slf4j/slf4j-api/1.7.36",
+    parent = "org.slf4j.slf4j-parent_1.7.36",
     visibility = ["//visibility:public"],
 )
 
 maven_import(
     name = "org.slf4j.slf4j-api",
     classifiers = [],
-    parent = "org.slf4j.slf4j-parent_1.7.32",
+    parent = "org.slf4j.slf4j-parent_1.7.36",
     jars = [
-        "repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar"
+        "repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"
     ],
     original_deps = [],
-    pom = "repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.pom",
+    pom = "repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
     repo_root_path = "repository",
-    repo_path = "org/slf4j/slf4j-api/1.7.32",
+    repo_path = "org/slf4j/slf4j-api/1.7.36",
     visibility = ["//visibility:public"],
 )
 
@@ -11260,10 +11260,8 @@
     jars = [
         "repository/org/testng/testng/7.5/testng-7.5.jar"
     ],
-    exports = [
-        "org.slf4j.slf4j-api",
-    ],
     deps = [
+        "org.slf4j.slf4j-api",
         "com.beust.jcommander",
         "org.webjars.jquery",
     ],
@@ -41887,6 +41885,17 @@
 )
 
 maven_artifact(
+    name = "com.google.devtools.ksp.com.google.devtools.ksp.gradle.plugin_2.0.0-RC1-1.0.20",
+    pom = "repository/com/google/devtools/ksp/com.google.devtools.ksp.gradle.plugin/2.0.0-RC1-1.0.20/com.google.devtools.ksp.gradle.plugin-2.0.0-RC1-1.0.20.pom",
+    repo_root_path = "repository",
+    repo_path = "com/google/devtools/ksp/com.google.devtools.ksp.gradle.plugin/2.0.0-RC1-1.0.20",
+    deps = [
+        "com.google.devtools.ksp.symbol-processing-gradle-plugin_2.0.0-RC1-1.0.20",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+maven_artifact(
     name = "com.google.devtools.ksp.symbol-processing-api_1.5.30-1.0.0",
     pom = "repository/com/google/devtools/ksp/symbol-processing-api/1.5.30-1.0.0/symbol-processing-api-1.5.30-1.0.0.pom",
     repo_root_path = "repository",
@@ -41953,6 +41962,28 @@
 )
 
 maven_artifact(
+    name = "com.google.devtools.ksp.symbol-processing-api_2.0.0-RC1-1.0.20",
+    pom = "repository/com/google/devtools/ksp/symbol-processing-api/2.0.0-RC1-1.0.20/symbol-processing-api-2.0.0-RC1-1.0.20.pom",
+    repo_root_path = "repository",
+    repo_path = "com/google/devtools/ksp/symbol-processing-api/2.0.0-RC1-1.0.20",
+    deps = [
+        "org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.9.0",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+maven_artifact(
+    name = "com.google.devtools.ksp.symbol-processing-common-deps_2.0.0-RC1-1.0.20",
+    pom = "repository/com/google/devtools/ksp/symbol-processing-common-deps/2.0.0-RC1-1.0.20/symbol-processing-common-deps-2.0.0-RC1-1.0.20.pom",
+    repo_root_path = "repository",
+    repo_path = "com/google/devtools/ksp/symbol-processing-common-deps/2.0.0-RC1-1.0.20",
+    deps = [
+        "org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.9.0",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+maven_artifact(
     name = "com.google.devtools.ksp.symbol-processing-gradle-plugin_1.7.10-1.0.6",
     pom = "repository/com/google/devtools/ksp/symbol-processing-gradle-plugin/1.7.10-1.0.6/symbol-processing-gradle-plugin-1.7.10-1.0.6.pom",
     repo_root_path = "repository",
@@ -42005,6 +42036,18 @@
 )
 
 maven_artifact(
+    name = "com.google.devtools.ksp.symbol-processing-gradle-plugin_2.0.0-RC1-1.0.20",
+    pom = "repository/com/google/devtools/ksp/symbol-processing-gradle-plugin/2.0.0-RC1-1.0.20/symbol-processing-gradle-plugin-2.0.0-RC1-1.0.20.pom",
+    repo_root_path = "repository",
+    repo_path = "com/google/devtools/ksp/symbol-processing-gradle-plugin/2.0.0-RC1-1.0.20",
+    deps = [
+        "com.google.devtools.ksp.symbol-processing-api_2.0.0-RC1-1.0.20",
+        "com.google.devtools.ksp.symbol-processing-common-deps_2.0.0-RC1-1.0.20",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+maven_artifact(
     name = "com.google.devtools.ksp.symbol-processing_1.7.10-1.0.6",
     pom = "repository/com/google/devtools/ksp/symbol-processing/1.7.10-1.0.6/symbol-processing-1.7.10-1.0.6.pom",
     repo_root_path = "repository",
@@ -42044,6 +42087,18 @@
 )
 
 maven_artifact(
+    name = "com.google.devtools.ksp.symbol-processing_2.0.0-RC1-1.0.20",
+    pom = "repository/com/google/devtools/ksp/symbol-processing/2.0.0-RC1-1.0.20/symbol-processing-2.0.0-RC1-1.0.20.pom",
+    repo_root_path = "repository",
+    repo_path = "com/google/devtools/ksp/symbol-processing/2.0.0-RC1-1.0.20",
+    deps = [
+        "org.jetbrains.kotlin.kotlin-stdlib_2.0.0-RC1",
+        "com.google.devtools.ksp.symbol-processing-api_2.0.0-RC1-1.0.20",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+maven_artifact(
     name = "com.google.errorprone.error_prone_annotations_2.0.18",
     pom = "repository/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.pom",
     repo_root_path = "repository",
@@ -56304,11 +56359,11 @@
 )
 
 maven_artifact(
-    name = "org.slf4j.slf4j-api_1.7.36",
-    pom = "repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
+    name = "org.slf4j.slf4j-api_1.7.32",
+    pom = "repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.pom",
     repo_root_path = "repository",
-    repo_path = "org/slf4j/slf4j-api/1.7.36",
-    parent = "org.slf4j.slf4j-parent_1.7.36",
+    repo_path = "org/slf4j/slf4j-api/1.7.32",
+    parent = "org.slf4j.slf4j-parent_1.7.32",
     visibility = ["//visibility:public"],
 )
 
diff --git a/bazel/maven/artifacts.bzl b/bazel/maven/artifacts.bzl
index dd31d42..4c31a36 100644
--- a/bazel/maven/artifacts.bzl
+++ b/bazel/maven/artifacts.bzl
@@ -150,7 +150,7 @@
     "org.eclipse.emf:org.eclipse.emf.ecore:2.12.0",
     "org.glassfish.jaxb:jaxb-runtime:2.3.2",
     "org.glassfish.jaxb:jaxb-xjc:2.3.2",
-    "org.gradle:gradle-tooling-api:8.6",
+    "org.gradle:gradle-tooling-api:8.7",
     "org.hamcrest:hamcrest-core:1.3",
     "org.hamcrest:hamcrest-library:1.3",
     "org.hdrhistogram:HdrHistogram:2.1.12",
@@ -637,12 +637,15 @@
     "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:pom:1.7.10-1.0.6",
     "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:pom:1.8.21-1.0.11",
     "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:pom:1.9.0-1.0.11",
+    "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:pom:2.0.0-RC1-1.0.20",
     "com.google.devtools.ksp:symbol-processing:1.7.10-1.0.6",
     "com.google.devtools.ksp:symbol-processing:1.8.10-1.0.9",
     "com.google.devtools.ksp:symbol-processing:1.8.21-1.0.11",
+    "com.google.devtools.ksp:symbol-processing:2.0.0-RC1-1.0.20",
     "com.google.devtools.ksp:symbol-processing-api:1.7.10-1.0.6",
     "com.google.devtools.ksp:symbol-processing-gradle-plugin:1.7.10-1.0.6",
     "com.google.devtools.ksp:symbol-processing-gradle-plugin:1.8.21-1.0.11",
+    "com.google.devtools.ksp:symbol-processing-gradle-plugin:2.0.0-RC1-1.0.20",
     "com.google.firebase:firebase-common:12.0.1",
     "com.google.firebase:firebase-crashlytics-gradle:2.5.1",
     "com.google.guava:guava:20.0",
diff --git a/build-system/BUILD b/build-system/BUILD
index 2aef9aa..f64cf68 100644
--- a/build-system/BUILD
+++ b/build-system/BUILD
@@ -98,7 +98,7 @@
 )
 
 # The Gradle APIs to build against and run against.
-GRADLE_VERSION = "8.6"
+GRADLE_VERSION = "8.7"
 
 filegroup(
     name = "gradle-distrib",
diff --git a/build-system/gradle-core/lint_baseline_tests.xml b/build-system/gradle-core/lint_baseline_tests.xml
index d465a24..e3971b6 100644
--- a/build-system/gradle-core/lint_baseline_tests.xml
+++ b/build-system/gradle-core/lint_baseline_tests.xml
@@ -426,7 +426,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt"
-            line="101"
+            line="89"
             column="9"/>
     </issue>
 
@@ -437,7 +437,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt"
-            line="105"
+            line="93"
             column="9"/>
     </issue>
 
@@ -579,6 +579,28 @@
         errorLine1="        TODO(&quot;Not yet implemented&quot;)"
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt"
+            line="157"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt"
+            line="161"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleExecOperations.kt"
             line="45"
             column="9"/>
@@ -833,7 +855,29 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt"
-            line="109"
+            line="106"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt"
+            line="110"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt"
+            line="117"
             column="9"/>
     </issue>
 
@@ -1064,7 +1108,18 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
-            line="112"
+            line="103"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="107"
             column="9"/>
     </issue>
 
@@ -1126,6 +1181,72 @@
     <issue
         id="StopShip"
         message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="140"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="144"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="148"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="152"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="156"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt"
+            line="160"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
         errorLine1="        TODO(&quot;not implemented&quot;)"
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~">
         <location
@@ -1295,7 +1416,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="91"
+            line="86"
             column="9"/>
     </issue>
 
@@ -1306,7 +1427,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="95"
+            line="90"
             column="9"/>
     </issue>
 
@@ -1350,6 +1471,17 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="111"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
             line="115"
             column="9"/>
     </issue>
@@ -1361,7 +1493,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="125"
+            line="119"
             column="9"/>
     </issue>
 
@@ -1372,7 +1504,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="129"
+            line="123"
             column="9"/>
     </issue>
 
@@ -1383,7 +1515,7 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="133"
+            line="127"
             column="9"/>
     </issue>
 
@@ -1394,7 +1526,62 @@
         errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
-            line="137"
+            line="131"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="139"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="149"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="153"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="157"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="StopShip"
+        message="`TODO` call found; points to code which must be fixed prior to release"
+        errorLine1="        TODO(&quot;Not yet implemented&quot;)"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt"
+            line="161"
             column="9"/>
     </issue>
 
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
index faf11b1..26173b8 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
@@ -198,7 +198,6 @@
     public static void prepareProject(
             @NonNull Project project, @NonNull Map<String, String> gradleProperties) {
         try {
-            addFakeService(project);
             loadGradleProperties(project, gradleProperties);
             addPrebuiltMavenRepository(project);
         } catch (IOException e) {
@@ -206,29 +205,6 @@
         }
     }
 
-    /**
-     * In Gradle 6.7-rc-1 BuildEventsListenerRegistry service is not created in we need it in order
-     * to instantiate AGP. This creates a fake one and injects it - http://b/168630734.
-     */
-    private static void addFakeService(Project project) {
-        try {
-            ProjectScopeServices gss =
-                    (ProjectScopeServices) ((DefaultProject) project).getServices();
-
-            Field state = ProjectScopeServices.class.getSuperclass().getDeclaredField("state");
-            state.setAccessible(true);
-            AtomicReference<Object> stateValue = (AtomicReference<Object>) state.get(gss);
-            Class<?> enumClass = Class.forName(DefaultServiceRegistry.class.getName() + "$State");
-            stateValue.set(enumClass.getEnumConstants()[0]);
-
-            // add service and set state so that future mutations are not allowed
-            gss.add(BuildEventsListenerRegistry.class, new FakeBuildEventsListenerRegistry());
-            stateValue.set(enumClass.getEnumConstants()[1]);
-        } catch (Throwable e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     // TODO(bingran) remove this workaround when gradle issue #13122 is fixed
     // https://github.com/gradle/gradle/issues/13122
     private static void loadGradleProperties(
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt
index e23decb..2bb7cf1 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleDirectoryProperty.kt
@@ -22,6 +22,7 @@
 import org.gradle.api.file.FileCollection
 import org.gradle.api.file.FileTree
 import org.gradle.api.file.RegularFile
+import org.gradle.api.provider.Property
 import org.gradle.api.provider.Provider
 import org.gradle.api.specs.Spec
 import java.io.File
@@ -85,6 +86,14 @@
         TODO("Not yet implemented")
     }
 
+    override fun unset(): Property<Directory> {
+        TODO("Not yet implemented")
+    }
+
+    override fun unsetConvention(): Property<Directory> {
+        TODO("Not yet implemented")
+    }
+
     override fun set(file: File?) {
         isSet = true
     }
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
index e2b6228..275f423 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
@@ -98,6 +98,14 @@
         TODO("Not yet implemented")
     }
 
+    override fun unset(): Property<T> {
+        TODO("Not yet implemented")
+    }
+
+    override fun unsetConvention(): Property<T> {
+        TODO("Not yet implemented")
+    }
+
     override fun forUseAtConfigurationTime(): Provider<T> {
         TODO("Not yet implemented")
     }
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt
index 08c6488..bb0c0df 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeListProperty.kt
@@ -83,6 +83,14 @@
         TODO("Not yet implemented")
     }
 
+    override fun unset(): ListProperty<T> {
+        TODO("Not yet implemented")
+    }
+
+    override fun unsetConvention(): ListProperty<T> {
+        TODO("Not yet implemented")
+    }
+
     override fun set(p0: MutableIterable<T>?) {
         TODO("Not yet implemented")
     }
@@ -104,6 +112,26 @@
         return this
     }
 
+    override fun appendAll(provider: Provider<out MutableIterable<T>>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun appendAll(elements: MutableIterable<T>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun appendAll(vararg elements: T) {
+        TODO("Not yet implemented")
+    }
+
+    override fun append(provider: Provider<out T>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun append(element: T) {
+        TODO("Not yet implemented")
+    }
+
     override fun add(p0: T) {
         values?.add(p0)
     }
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt
index fa6e326..875d407 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixtures/FakeMapProperty.kt
@@ -82,11 +82,35 @@
         TODO("Not yet implemented")
     }
 
+    override fun unset(): MapProperty<K, V> {
+        TODO("Not yet implemented")
+    }
+
+    override fun unsetConvention(): MapProperty<K, V> {
+        TODO("Not yet implemented")
+    }
+
     override fun empty(): MapProperty<K, V> {
         values?.clear()
         return this
     }
 
+    override fun insertAll(provider: Provider<out MutableMap<out K, out V>>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun insertAll(entries: MutableMap<out K, out V>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun insert(key: K, providerOfValue: Provider<out V>) {
+        TODO("Not yet implemented")
+    }
+
+    override fun insert(key: K, value: V) {
+        TODO("Not yet implemented")
+    }
+
     override fun getting(p0: K): Provider<V> {
         TODO("Not yet implemented")
     }
diff --git a/build-system/integration-test/BUILD.bazel b/build-system/integration-test/BUILD.bazel
index a62e67c..38711e2 100644
--- a/build-system/integration-test/BUILD.bazel
+++ b/build-system/integration-test/BUILD.bazel
@@ -86,6 +86,12 @@
     visibility = [":__subpackages__"],
 )
 
+# Kotlin dependencies for Gradle
+KTS = [
+    "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.9.22",
+    "@maven//:org.jetbrains.kotlin.kotlin-reflect_1.9.22",
+]
+
 # Kotlin Gradle plugin dependencies
 # IMPORTANT: This list should generally not be used as it contains mixed versions. It's here only
 # for historical reasons and should be removed at some point. Consider using
@@ -105,23 +111,22 @@
         "@maven//:org.jetbrains.kotlin.kotlin-reflect_1.8.20",
         "@maven//:org.jetbrains.kotlin.kotlin-reflect_1.9.0",
         "@maven//:org.jetbrains.kotlin.kotlin-reflect_1.9.10",
-        "@maven//:org.jetbrains.kotlin.kotlin-reflect_1.9.22",
         "@maven//:org.jetbrains.kotlin.kotlin-script-runtime_1.6.21",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.6.21",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.8.0",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.8.10",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.8.20",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.9.0",
-    ],
+    ] + KTS,
     visibility = ["//visibility:public"],
 )
 
 maven_repository(
     name = "ksp_gradle_plugin",
     artifacts = [
-        "@maven//:com.google.devtools.ksp.symbol-processing_1.7.10-1.0.6",
-        "@maven//:com.google.devtools.ksp.com.google.devtools.ksp.gradle.plugin_1.7.10-1.0.6",
-        "@maven//:com.google.devtools.ksp.symbol-processing-gradle-plugin_1.7.10-1.0.6",
+        "@maven//:com.google.devtools.ksp.symbol-processing_2.0.0-RC1-1.0.20",
+        "@maven//:com.google.devtools.ksp.com.google.devtools.ksp.gradle.plugin_2.0.0-RC1-1.0.20",
+        "@maven//:com.google.devtools.ksp.symbol-processing-gradle-plugin_2.0.0-RC1-1.0.20",
     ],
     visibility = ["//visibility:public"],
 )
@@ -144,6 +149,8 @@
         "@maven//:org.jetbrains.kotlin.android.org.jetbrains.kotlin.android.gradle.plugin_1.9.22",
         "@maven//:org.jetbrains.kotlin.jvm.org.jetbrains.kotlin.jvm.gradle.plugin_1.9.22",
         "@maven//:org.jetbrains.kotlin.kotlin-android-extensions-runtime_1.9.22",
+        "@maven//:org.jetbrains.kotlin.kotlin-stdlib-common_1.9.22",
+        "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk7_1.9.22",
         "@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8_1.8.0",
     ],
     visibility = ["//visibility:public"],
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/MissingDependencyModelTest.kt b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/MissingDependencyModelTest.kt
index 1577aa5..215a320 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/MissingDependencyModelTest.kt
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/MissingDependencyModelTest.kt
@@ -97,26 +97,26 @@
         Truth.assertThat(unresolvedDeps.single().name).isEqualTo("project :lib")
         Truth.assertThat(unresolvedDeps.single().cause).isEqualTo(
                 """
-No matching variant of project :lib was found. The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
-  - Variant 'debugApiElements' capability project:lib:unspecified declares a component for use during compile-time, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
+No matching variant of project :lib was found. The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
+  - Variant 'debugApiElements' declares a component for use during compile-time, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
       - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging'
       - Other compatible attributes:
           - Doesn't say anything about its component category (required a library)
           - Doesn't say anything about its target Java environment (preferred optimized for Android)
           - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
-  - Variant 'debugRuntimeElements' capability project:lib:unspecified declares a component for use during runtime, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
+  - Variant 'debugRuntimeElements' declares a component for use during runtime, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
       - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging'
       - Other compatible attributes:
           - Doesn't say anything about its component category (required a library)
           - Doesn't say anything about its target Java environment (preferred optimized for Android)
           - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
-  - Variant 'releaseApiElements' capability project:lib:unspecified declares a component for use during compile-time, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
+  - Variant 'releaseApiElements' declares a component for use during compile-time, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
       - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging'
       - Other compatible attributes:
           - Doesn't say anything about its component category (required a library)
           - Doesn't say anything about its target Java environment (preferred optimized for Android)
           - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
-  - Variant 'releaseRuntimeElements' capability project:lib:unspecified declares a component for use during runtime, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
+  - Variant 'releaseRuntimeElements' declares a component for use during runtime, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '{AGP-VERSION}':
       - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'staging'
       - Other compatible attributes:
           - Doesn't say anything about its component category (required a library)
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/privacysandbox/PrivacySandboxMediatorSdkTest.kt b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/privacysandbox/PrivacySandboxMediatorSdkTest.kt
index 74c63ac..3b64b6f 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/privacysandbox/PrivacySandboxMediatorSdkTest.kt
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/privacysandbox/PrivacySandboxMediatorSdkTest.kt
@@ -81,6 +81,7 @@
         │                                           │
         └───────────────────────────────────────────┘
          */
+        withKotlinPlugin = true
         subProject(":app") {
             plugins.add(PluginType.ANDROID_APP)
             android {
diff --git a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/PluginType.kt b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/PluginType.kt
index 25c2416..c9431ab 100644
--- a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/PluginType.kt
+++ b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/PluginType.kt
@@ -69,7 +69,7 @@
             isKotlin = true,
             useNewDsl = true,
             last = true,
-            version = "1.7.10-1.0.6"
+            version = "2.0.0-RC1-1.0.20"
     )
     object KOTLIN_MPP: PluginType(
         id = "org.jetbrains.kotlin.multiplatform",
diff --git a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestProjects.kt b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestProjects.kt
index 3e338e8..ea21cc5 100644
--- a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestProjects.kt
+++ b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestProjects.kt
@@ -101,6 +101,7 @@

         sdk-impl-b
          */
+        withKotlinPlugin = true
         // An SDK module used by the :example-app application.
         privacySandboxSdkProject(":privacy-sandbox-sdk") {
             android {
diff --git a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestUtils.kt b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestUtils.kt
index 7f1f716..620a73e 100644
--- a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestUtils.kt
+++ b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/testprojects/prebuilts/privacysandbox/PrivacySandboxSdkTestUtils.kt
@@ -22,6 +22,7 @@
 import com.android.build.gradle.integration.common.utils.SdkHelper
 import com.android.sdklib.BuildToolInfo
 import com.android.testutils.TestUtils.KOTLIN_VERSION_FOR_TESTS
+import org.gradle.api.JavaVersion
 
 private val aidlPath = SdkHelper.getBuildTool(BuildToolInfo.PathId.AIDL).absolutePath
         .replace("""\""", """\\""")
@@ -46,6 +47,13 @@
         plugins.add(PluginType.KSP)
         android {
             defaultCompileSdk()
+            compileOptions {
+                sourceCompatibility = JavaVersion.VERSION_1_8
+                targetCompatibility = JavaVersion.VERSION_1_8
+            }
+            kotlinOptions {
+                jvmTarget = "1.8"
+            }
         }
         dependencies {
             implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10")
diff --git a/build-system/supported-versions.properties b/build-system/supported-versions.properties
index 27b1513..ca7f0a6 100644
--- a/build-system/supported-versions.properties
+++ b/build-system/supported-versions.properties
@@ -17,7 +17,7 @@
 # Used as a data source by developers.android.com
 
 gradle_name="Gradle"
-gradle_minimum=8.6
-gradle_default=8.6
+gradle_minimum=8.7
+gradle_default=8.7
 gradle_notes="To learn more, see <a href='/build/releases/gradle-plugin?buildsystem=ndk-build#updating-gradle'>updating Gradle</a>."
 
diff --git a/common/src/main/java/com/android/SdkConstants.java b/common/src/main/java/com/android/SdkConstants.java
index 772b221..fcd6717 100644
--- a/common/src/main/java/com/android/SdkConstants.java
+++ b/common/src/main/java/com/android/SdkConstants.java
@@ -2872,7 +2872,7 @@
      * Studio product. It need not actually be the latest version of Gradle, but it will most likely
      * be fairly recent.
      */
-    public static final String GRADLE_LATEST_VERSION = "8.6";
+    public static final String GRADLE_LATEST_VERSION = "8.7";
 
     /**
      * The minimum released version of the Android Gradle Plugin that this version of Studio will
diff --git a/testutils/src/main/java/com/android/testutils/TestUtils.java b/testutils/src/main/java/com/android/testutils/TestUtils.java
index d152ea3..ab47e59 100644
--- a/testutils/src/main/java/com/android/testutils/TestUtils.java
+++ b/testutils/src/main/java/com/android/testutils/TestUtils.java
@@ -64,7 +64,7 @@
      * upgrade the test projects to the latest version of the Kotlin Gradle plugin if there isn't a
      * compatible Compose version yet.
      */
-    public static final String KOTLIN_VERSION_FOR_COMPOSE_TESTS = "1.9.20";
+    public static final String KOTLIN_VERSION_FOR_COMPOSE_TESTS = "1.9.22";
 
     /** Compose compiler compatible with {@link #KOTLIN_VERSION_FOR_COMPOSE_TESTS}. */
     public static final String COMPOSE_COMPILER_FOR_TESTS = "1.5.11";