Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] fix
.aar
files flowing from project r…
…eferences (#8193) Fixes: #8190 In a customer sample, they have an `.aar` file they need the Java code from, but do not want a C# binding for it: <AndroidLibrary Update="FooNonBinding-release.aar" Bind="false" /> `Bind="false"` looks to have the side effect where: 1. It does not get copied to the output directory. 2. The Java types don't make it to the final app. 3. Crash at runtime: java.lang.ClassNotFoundException: Didn't find class "com.example.foononbinding.FooSample" on path A workaround is to add a line such as: <None Include="FooNonBinding-release.aar" CopyToOutputDirectory="PreserveNewest" /> I could reproduce this issue by updating our existing `DotNetBuildLibrary` test. I could assert the file exists in the output directory, as well as actually using `dexdump` to verify Java classes make it to the app. They did not! The solution here being that we are missing a line such as: <!-- .aar files should be copied to $(OutputPath) in .NET 6--> ++<None Include="@(AndroidAarLibrary)" TfmSpecificPackageFile="%(AndroidAarLibrary.Pack)" Pack="false" CopyToOutputDirectory="PreserveNewest" Link="%(Filename)%(Extension)" /> <None Include="@(LibraryProjectZip)" TfmSpecificPackageFile="%(LibraryProjectZip.Pack)" Pack="false" CopyToOutputDirectory="PreserveNewest" Link="%(Filename)%(Extension)" /> Now the `DotNetBuildLibrary` test passes.
- Loading branch information