Revert "Revert "R8/D8 should use sdk_version prop to determine API surface stability.""

This reverts commit 7eb9243fa78189000da9d5beeabaea3b8b2c0fd5.

Reason for revert: The original change was reverted since it was suspected to cause missing libc++.so errors. It was a red herring, and the root cause has been fixed now b/264588525

Change-Id: Ib9110c41bacf220b91f24de11589f63235895e56
diff --git a/java/base.go b/java/base.go
index 55d77dc..6e42aef 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1488,7 +1488,14 @@
 			}
 			// Dex compilation
 			var dexOutputFile android.OutputPath
-			dexOutputFile = j.dexer.compileDex(ctx, flags, j.MinSdkVersion(ctx), implementationAndResourcesJar, jarName)
+			params := &compileDexParams{
+				flags:         flags,
+				sdkVersion:    j.SdkVersion(ctx),
+				minSdkVersion: j.MinSdkVersion(ctx),
+				classesJar:    implementationAndResourcesJar,
+				jarName:       jarName,
+			}
+			dexOutputFile = j.dexer.compileDex(ctx, params)
 			if ctx.Failed() {
 				return
 			}