Skip to content

Commit 9434b4b

Browse files
jonathanpeppersjonpryor
authored andcommitted
[build] delete platform-31 folder on test jobs (#6103)
Context: #6089 We currently have lots of test failures due to the warning: warning XA1008: The TargetFrameworkVersion (Android API level 30) is lower than the targetSdkVersion (31). Please increase the `$(TargetFrameworkVersion)` or decrease the `android:targetSdkVersion` in the `AndroidManifest.xml` so that the API levels match. Looking at `Properties\AndroidManifest.xml`, Xamarin.ProjectTools generated: <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" /> This appears to be due to the `GetMaxInstalledPlatform()` method: https://github.com/xamarin/xamarin-android/blob/1b71da0cd3a44861b006ac41c77a24eedf066281/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/AndroidSdkResolver.cs#L121-L138 I think what happened is: * #6089 is opened, platform-31 gets installed on many of the CI machines. * Future PRs install `platform-S` side-by-side `platform-31`. And so we ended up with test failures... To fix this for now, manually delete the `sdk/platform-31` folder on test jobs.
1 parent ec2a35c commit 9434b4b

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ stages:
171171

172172
- template: yaml-templates\clean.yaml
173173

174+
- template: yaml-templates\delete-platform-31.yaml
175+
174176
- script: |
175177
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder)
176178
displayName: set JI_JAVA_HOME
@@ -291,6 +293,8 @@ stages:
291293

292294
- template: yaml-templates\clean.yaml
293295

296+
- template: yaml-templates\delete-platform-31.yaml
297+
294298
- script: |
295299
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%USERPROFILE%\android-toolchain\$(XA.Jdk11.Folder)
296300
displayName: set JI_JAVA_HOME
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# NOTE: temporary workaround to delete platform-31
2+
steps:
3+
4+
- script: rm -rfv "$HOME/Library/Android/sdk/platforms/android-31"
5+
displayName: delete API 31
6+
condition: and(succeeded(), eq(variables['agent.os'], 'Darwin'))
7+
8+
- script: if exist "%USERPROFILE%\android-toolchain\sdk\platforms\android-31" rmdir /s /q "%USERPROFILE%\android-toolchain\sdk\platforms\android-31"
9+
displayName: delete API 31
10+
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))

build-tools/automation/yaml-templates/setup-test-environment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ steps:
1919
parameters:
2020
provisionExtraArgs: ${{ parameters.provisionExtraArgs }}
2121

22+
- template: delete-platform-31.yaml
23+
2224
- script: |
2325
echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/Library/Android/${{ parameters.jdkTestFolder }}"
2426
echo "##vso[task.setvariable variable=DOTNET_TOOL_PATH]$HOME/Library/Android/dotnet/dotnet"

0 commit comments

Comments
 (0)