Fix archive of smali build

Usages of e.g. List.of() requires JDK-9 or later. Using JDK-11.

Fixes: https://github.com/google/smali/issues/32
Change-Id: I1573477859fe1f37a45e6c7083562bc8063722ab
diff --git a/tools/archive_smali.py b/tools/archive_smali.py
index fac42c5..fa516e2 100755
--- a/tools/archive_smali.py
+++ b/tools/archive_smali.py
@@ -15,6 +15,7 @@
 import subprocess
 import sys
 
+import jdk
 import utils
 
 ARCHIVE_BUCKET = 'r8-releases'
@@ -99,14 +100,16 @@
 
             print('Building version: %s' % version)
 
-            # Build release to local Maven repository.
+            # Build release to local Maven repository compiling with JDK-11.
             m2 = os.path.join(temp, 'm2')
             os.mkdir(m2)
+            env = os.environ.copy()
+            env["JAVA_HOME"] = jdk.GetJdk11Home()
             subprocess.check_call([
                 './gradlew',
                 '-Dmaven.repo.local=%s' % m2, 'release', 'test',
-                'publishToMavenLocal'
-            ])
+                'publishToMavenLocal',
+            ], env=env)
             base = os.path.join('com', 'android', 'tools', 'smali')
 
             # Check that the local maven repository only has the single version directory in