Commit 02bd7db
committed
[Xamarin.Android.Build.Tasks] fix
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..aar files flowing from project references (#8193)1 parent c92e022 commit 02bd7db
File tree
2 files changed
+14
-0
lines changed- src/Xamarin.Android.Build.Tasks
- MSBuild/Xamarin/Android
- Tests/Xamarin.Android.Build.Tests
2 files changed
+14
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| |||
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
| 167 | + | |
159 | 168 | | |
160 | 169 | | |
161 | 170 | | |
| |||
217 | 226 | | |
218 | 227 | | |
219 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
220 | 233 | | |
221 | 234 | | |
222 | 235 | | |
| |||
0 commit comments