Increase R8 max heap size to 4GB

The size was increased for D8 in an earlier change, but is more
critical for R8. Match the D8 configuration.

Bug: 241220562,283888124
Test: m
(cherry picked from https://android-review.googlesource.com/q/commit:3e65f2a53c6e5fd82ddad403360bb87b986ad0d8)
Merged-In: I3b98bf6098f2196c87a97f6c8f7308d9299170d8
Change-Id: I3b98bf6098f2196c87a97f6c8f7308d9299170d8
diff --git a/java/config/config.go b/java/config/config.go
index b82a137..195dae1 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -98,7 +98,7 @@
 		"-JDcom.android.tools.r8.emitRecordAnnotationsExInDex",
 	}, dexerJavaVmFlagsList...))
 	exportedVars.ExportStringListStaticVariable("R8Flags", append([]string{
-		"-JXmx2048M",
+		"-JXmx4096M",
 		"-JDcom.android.tools.r8.emitRecordAnnotationsInDex",
 		"-JDcom.android.tools.r8.emitPermittedSubclassesAnnotationsInDex",
 		"-JDcom.android.tools.r8.emitRecordAnnotationsExInDex",