[Microsoft.Android.Ref] use reference assembly for Mono.Android.dll #5119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Microsoft.Android.Ref.nupkgfile is meant to only containreference assemblies, and we are currently shipping the real assembly.
The actual runtime assembly is found in the runtime pack for each RID:
Microsoft.Android.Runtime.android.21-arm.nupkgMicrosoft.Android.Runtime.android.21-arm64.nupkgMicrosoft.Android.Runtime.android.21-x86.nupkgMicrosoft.Android.Runtime.android.21-x64.nupkgTo fix this, we need to set
$(ProduceReferenceAssembly)for eachassembly we distribute in
Microsoft.Android.Ref.The MSBuild targets in dotnet/sdk already handle passing the correct
reference assembly to the
<Csc/>MSBuild task, and passing us theruntime assembly to place in
.apkfiles.I also cleaned up
Mono.Android.Export.csprojso we don't need toclear
$(BuildDependsOn)after manually importingMicrsoft.NET.Sdk.We could simply change
$(TargetFrameworks)instead.Using a reference assembly has the benefit of saving ~3.5 MB of file
size:
And saves ~18.9 MB when extracted:
We will need a future change in xamarin/java.interop to make a
reference assembly for
Java.Interop.dll.