Fix run_on_app.py for gmscore and Youtube

GMSCore and Youtube don't fit in one dex and no multidex rule/list is given, so
a min sdk compatible with native multidex is required.

Change-Id: Ibb894b871d918d65bf01f54b05133252c2646a6a
diff --git a/tools/gmscore_data.py b/tools/gmscore_data.py
index 4b9c430..9939e1c 100644
--- a/tools/gmscore_data.py
+++ b/tools/gmscore_data.py
@@ -20,6 +20,7 @@
 
 V10_BASE = os.path.join(BASE, 'gmscore_v10')
 V10_PREFIX = os.path.join(V10_BASE, 'GmsCore_prod_alldpi_release_all_locales')
+ANDROID_L_API = '21'
 
 # NOTE: we always use android.jar for SDK v25, later we might want to revise it
 #       to use proper android.jar version for each of gmscore version separately.
@@ -32,6 +33,7 @@
       'pgmap' : os.path.join(V4_BASE, 'proguard.map'),
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   'v5': {
@@ -40,6 +42,7 @@
       'pgmap' : os.path.join(V5_BASE, 'proguard.map'),
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   'v6': {
@@ -48,6 +51,7 @@
       'pgmap' : os.path.join(V6_BASE, 'proguard.map'),
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   'v7': {
@@ -56,6 +60,7 @@
       'pgmap' : os.path.join(V7_BASE, 'proguard.map'),
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   'v8': {
@@ -64,6 +69,7 @@
       'pgmap' : os.path.join(V8_BASE, 'proguard.map'),
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   'v9': {
@@ -72,15 +78,18 @@
       'pgmap': '%s_proguard.map' % V9_PREFIX,
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     },
     'deploy' : {
       'pgconf': ['%s_proguard.config' % V9_PREFIX],
-      'inputs': ['%s_deploy.jar' % V9_PREFIX]
+      'inputs': ['%s_deploy.jar' % V9_PREFIX],
+      'min-sdk-version' : ANDROID_L_API,
     },
     'proguarded' : {
       'inputs': ['%s_proguard.jar' % V9_PREFIX],
-      'pgmap': '%s_proguard.map' % V9_PREFIX
-    }
+      'pgmap': '%s_proguard.map' % V9_PREFIX,
+      'min-sdk-version' : ANDROID_L_API,
+     }
   },
   'v10': {
     'dex' : {
@@ -88,14 +97,17 @@
       'pgmap': '%s_proguard.map' % V10_PREFIX,
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     },
     'deploy' : {
       'inputs': ['%s_deploy.jar' % V10_PREFIX],
       'pgconf': ['%s_proguard.config' % V10_PREFIX],
+      'min-sdk-version' : ANDROID_L_API,
     },
     'proguarded' : {
       'inputs': ['%s_proguard.jar' % V10_PREFIX],
-      'pgmap': '%s_proguard.map' % V10_PREFIX
+      'pgmap': '%s_proguard.map' % V10_PREFIX,
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
 }
diff --git a/tools/run_on_app.py b/tools/run_on_app.py
index ddc1e47..312f4b0a 100755
--- a/tools/run_on_app.py
+++ b/tools/run_on_app.py
@@ -125,6 +125,8 @@
     inputs = values['inputs']
 
   args.extend(['--output', outdir])
+  if 'min-sdk-version' in values:
+    args.extend(['--min-sdk-version', values['min-sdk-version']])
 
   if options.compiler == 'r8':
     if 'pgmap' in values:
diff --git a/tools/youtube_data.py b/tools/youtube_data.py
index b32a372..5ec6bee 100644
--- a/tools/youtube_data.py
+++ b/tools/youtube_data.py
@@ -7,6 +7,7 @@
 import utils
 
 THIRD_PARTY = os.path.join(utils.REPO_ROOT, 'third_party')
+ANDROID_L_API = '21'
 BASE = os.path.join(THIRD_PARTY, 'youtube')
 
 V12_10_BASE = os.path.join(BASE, 'youtube.android_12.10')
@@ -29,15 +30,18 @@
       'pgmap': '%s_proguard.map' % V12_10_PREFIX,
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     },
     'deploy' : {
       'inputs': ['%s_deploy.jar' % V12_10_PREFIX],
       'pgconf': ['%s_proguard.config' % V12_10_PREFIX,
                  '%s/proguardsettings/YouTubeRelease_proguard.config' % THIRD_PARTY],
+      'min-sdk-version' : ANDROID_L_API,
     },
     'proguarded' : {
       'inputs': ['%s_proguard.jar' % V12_10_PREFIX],
-      'pgmap': '%s_proguard.map' % V12_10_PREFIX
+      'pgmap': '%s_proguard.map' % V12_10_PREFIX,
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   '12.17': {
@@ -46,15 +50,18 @@
       'pgmap': '%s_proguard.map' % V12_17_PREFIX,
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     },
     'deploy' : {
       'inputs': ['%s_deploy.jar' % V12_17_PREFIX],
       'pgconf': ['%s_proguard.config' % V12_17_PREFIX,
                  '%s/proguardsettings/YouTubeRelease_proguard.config' % THIRD_PARTY],
+      'min-sdk-version' : ANDROID_L_API,
     },
     'proguarded' : {
       'inputs': ['%s_proguard.jar' % V12_17_PREFIX],
-      'pgmap': '%s_proguard.map' % V12_17_PREFIX
+      'pgmap': '%s_proguard.map' % V12_17_PREFIX,
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
   '12.22': {
@@ -63,6 +70,7 @@
       'pgmap': '%s_proguard.map' % V12_22_PREFIX,
       'libraries' : [ANDROID_JAR],
       'r8-flags': '--ignore-missing-classes',
+      'min-sdk-version' : ANDROID_L_API,
     },
     'deploy' : {
       'inputs': ['%s_deploy.jar' % V12_22_PREFIX],
@@ -73,10 +81,12 @@
           os.path.join(V12_22_BASE, 'mainDexClasses.rules'),
           os.path.join(V12_22_BASE, 'main-dex-classes-release.cfg'),
           os.path.join(V12_22_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
+      'min-sdk-version' : ANDROID_L_API,
     },
     'proguarded' : {
       'inputs': ['%s_proguard.jar' % V12_22_PREFIX],
-      'pgmap': '%s_proguard.map' % V12_22_PREFIX
+      'pgmap': '%s_proguard.map' % V12_22_PREFIX,
+      'min-sdk-version' : ANDROID_L_API,
     }
   },
 }