@@ -84,7 +84,6 @@ public class Aapt2Link : Aapt2 {
84
84
SortedSet < string > rulesFiles = new SortedSet < string > ( ) ;
85
85
Dictionary < string , long > apks = new Dictionary < string , long > ( ) ;
86
86
string resourceSymbolsTextFileTemp ;
87
- int ? minSdkVersion ;
88
87
89
88
protected override int GetRequiredDaemonInstances ( )
90
89
{
@@ -98,13 +97,6 @@ public async override System.Threading.Tasks.Task RunTaskAsync ()
98
97
99
98
resourceSymbolsTextFileTemp = GetTempFile ( ) ;
100
99
101
- // Compute min SDK version once from AndroidManifestFile or first ManifestFiles item
102
- ITaskItem manifestFile = AndroidManifestFile ?? ( ManifestFiles ? . Length > 0 ? ManifestFiles [ 0 ] : null ) ;
103
- if ( manifestFile is { ItemSpec . Length : > 0 } ) {
104
- var doc = AndroidAppManifest . Load ( manifestFile . ItemSpec , MonoAndroidHelper . SupportedVersions ) ;
105
- minSdkVersion = doc . MinSdkVersion ;
106
- }
107
-
108
100
await this . WhenAll ( ManifestFiles , ProcessManifest ) ;
109
101
110
102
ProcessOutput ( ) ;
@@ -186,13 +178,6 @@ string [] GenerateCommandLineCommands (string ManifestFile, string currentAbi, s
186
178
cmd . Add ( "-v" ) ;
187
179
cmd . Add ( $ "--manifest") ;
188
180
cmd . Add ( GetFullPath ( manifestFile ) ) ;
189
-
190
- //NOTE: if this is blank, we can omit --min-sdk-version in this call
191
- if ( minSdkVersion . HasValue ) {
192
- cmd . Add ( "--min-sdk-version" ) ;
193
- cmd . Add ( minSdkVersion . Value . ToString ( ) ) ;
194
- }
195
-
196
181
if ( ! string . IsNullOrEmpty ( JavaDesignerOutputDirectory ) ) {
197
182
var designerDirectory = Path . IsPathRooted ( JavaDesignerOutputDirectory ) ? JavaDesignerOutputDirectory : Path . Combine ( WorkingDirectory , JavaDesignerOutputDirectory ) ;
198
183
Directory . CreateDirectory ( designerDirectory ) ;
@@ -335,6 +320,15 @@ string [] GenerateCommandLineCommands (string ManifestFile, string currentAbi, s
335
320
cmd . Add ( "-o" ) ;
336
321
cmd . Add ( GetFullPath ( currentResourceOutputFile ) ) ;
337
322
323
+ // Add min SDK version from AndroidManifestFile if available
324
+ if ( AndroidManifestFile is { ItemSpec . Length : > 0 } ) {
325
+ var doc = AndroidAppManifest . Load ( AndroidManifestFile . ItemSpec , MonoAndroidHelper . SupportedVersions ) ;
326
+ if ( doc . MinSdkVersion . HasValue ) {
327
+ cmd . Add ( "--min-sdk-version" ) ;
328
+ cmd . Add ( doc . MinSdkVersion . Value . ToString ( ) ) ;
329
+ }
330
+ }
331
+
338
332
return cmd . ToArray ( ) ;
339
333
}
340
334
0 commit comments