diff --git a/lib/src/commands/build/build.dart b/lib/src/commands/build/build.dart index 869bfd3..3d1e3d6 100644 --- a/lib/src/commands/build/build.dart +++ b/lib/src/commands/build/build.dart @@ -158,7 +158,7 @@ class BuildCommand extends Command { _lgr.startTask('Generating DEX bytecode'); try { - await Executor.execD8(artJarPath); + await Executor.execD8(config, artJarPath); } catch (e, s) { _catchAndStop(e, s); return 1; diff --git a/lib/src/commands/build/tools/executor.dart b/lib/src/commands/build/tools/executor.dart index a4128ef..284b7b5 100644 --- a/lib/src/commands/build/tools/executor.dart +++ b/lib/src/commands/build/tools/executor.dart @@ -15,10 +15,11 @@ class Executor { static final _libService = GetIt.I(); static final _processRunner = ProcessRunner(); - static Future execD8(String artJarPath) async { + static Future execD8(Config config, String artJarPath) async { final args = [ ...['-cp', await _libService.r8Jar()], 'com.android.tools.r8.D8', + ...['--min-api', '${config.minSdk}'], ...[ '--lib', p.join(_fs.libsDir.path, 'android-$androidPlatformSdkVersion.jar') @@ -134,6 +135,7 @@ class Executor { ...['--input', '\'$artJarPath\''], ...['--output', '\'${outputJar.path}\''], ...classpathJars.map((dep) => '--classpath_entry' '\n' '\'$dep\''), + ...['--min_sdk_version', '${config.minSdk}'], ]; final argsFile = p.join(_fs.buildFilesDir.path, 'desugar.args').asFile(true);