Commit 8ea1708
committed
[One .NET] specify all RIDs by default
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1413756
Fixes: #6353
The API 31 emulator no longer has 32-bit images and the x86_64 image
has dropped support for 32-bit architectures:
> adb shell getprop | grep cpu
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64,arm64-v8a]
[ro.product.cpu.abilist32]: []
[ro.product.cpu.abilist64]: [x86_64,arm64-v8a]
Compared to an API 30 x86_64 emulator:
> adb shell getprop | grep cpu
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64,x86,arm64-v8a,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: [x86_64,arm64-v8a]
The problem is our default RIDs are:
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifiers)' == '' ">android-arm64;android-x86</RuntimeIdentifiers>
And so you hit this error when trying to deploy a `dotnet new android`
app on an API 31 x86_64 emulator:
error ADB0020: Mono.AndroidTools.IncompatibleCpuAbiExceptiopn: The package does not support the CPU architecture of this device.
To workaround this, you can add `android-x64` to your list of
`$(RuntimeIdentifiers)`.
To solve this issue, we can default `$(RuntimeIdentifiers)` to all 4
architectures. We have code that will select a single architecture for
Debug builds using "Fast Deployment". It seems better to have a
default here that will always work, and the only drawback would be the
additional architectures for Release builds.
After this change, I discovered an issue introduced in 33a6d1e:
ILLink error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [C:\a\_work\1\s\bin\TestRelease\temp\BuildProguard Enabled Project(1)Trued8r8\UnnamedProject.csproj]
...
Unhandled exception. System.IO.IOException: The process cannot access the file 'C:\a\_work\1\s\bin\TestRelease\temp\BuildProguard Enabled Project(1)Trued8r8\obj\Release\proguard\proguard_project_references.cfg' because it is being used by another process.
When we build each RID in parallel, each inner build was attempting to
write to the same file. I changed the path for this file to be:
$(IntermediateOutputPath)%(_RIDs.Identity)\proguard\proguard_project_references.cfg
And then set `$(_ProguardProjectConfiguration)` appropriately after
the inner builds complete. This also needs to actually be a file path,
I don't see how the value was working before:
<_ProguardProjectConfiguration Condition=" '$(AndroidLinkTool)' != '' ">;_ProguardProjectConfiguration=$(IntermediateOutputPath)proguard\proguard_project_references.cfg</_ProguardProjectConfiguration>
Then another related issue:
(_TouchAndroidLinkFlag target) ->
Microsoft.Android.Sdk.ILLink.targets(114,5): error MSB3371: The file "obj\Release\net6.0-android\link.flag" cannot be created. The process cannot access the file 'C:\a\_work\2\s\bin\TestRelease\temp\DotNetBuildandroid-armandroid-arm64android-x86android-x64TrueTrue\obj\Release\net6.0-android\link.flag' because it is being used by another process.
I setup `$(_AndroidLinkFlag)` the same as
`$(_ProguardProjectConfiguration)` to solve this issue.1 parent 8866030 commit 8ea1708
3 files changed
Lines changed: 8 additions & 4 deletions
File tree
- src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
| |||
90 | 87 | | |
91 | 88 | | |
92 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments