-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release builds fail if imported AAR library contains a lint.jar file #4565
Comments
Thanks for confirming! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@brendanzagaeski I'm seeing this issue in Xamarin.Android 10.3.1.4 VS 2019 Version 8.6.8 (build 2) R8: Warning: Missing class: org.conscrypt.ConscryptHostnameVerifier |
@hadigityat, thanks for testing this! I can confirm that this behavior is indeed not fixed for the case where a bindings projects uses the LibraryProjectZip build action to embed a .aar file within the output bindings library project managed assembly. The fix from #4385 only works when the .aar file is instead packaged alongside the managed assembly as a separate file in a NuGet package archive. Since that is not currently the default workflow for Xamarin.Android bindings projects, I am reopening this issue. Steps to reproduceAdd the following test to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs and run it:
Expected behaviorThe test should pass. Actual behaviorThe |
Fixes: dotnet#4565 Context: dotnet#4565 (comment) In f230b87, I fixed `lint.jar` from being included in apps from the `@(AndroidAarLibrary)` item group. Unfortunately, this did not fix the scenario for `@(LibraryProjectZip)` in binding projects! I moved the `skipCallback` used in the `<ResolveLibraryProjectImports/>` to a common place in the `Files` class so it can also be used by the `<CreateLibraryResourceArchive/>` MSBuild task. I brought over Brendan's test that reproduces the bug as well. Co-authored by: Brendan Zagaeski <brzaga@microsoft.com>
Fixes: dotnet#4565 Context: dotnet#4565 (comment) In f230b87, I fixed `lint.jar` from being included in apps from the `@(AndroidAarLibrary)` item group. Unfortunately, this did not fix the scenario for `@(LibraryProjectZip)` in binding projects! I moved the `skipCallback` used in the `<ResolveLibraryProjectImports/>` to a common place in the `Files` class so it can also be used by the `<CreateLibraryResourceArchive/>` MSBuild task. We need to use this for `.aar` files *only*, because `.zip` files could be *any* format. I brought over Brendan's test that reproduces the bug as well. Co-authored by: Brendan Zagaeski <brzaga@microsoft.com>
Fixes: dotnet#4565 Context: dotnet#4565 (comment) In f230b87, I fixed `lint.jar` from being included in apps from the `@(AndroidAarLibrary)` item group. Unfortunately, this did not fix the scenario for `@(LibraryProjectZip)` in binding projects! I moved the `skipCallback` used in the `<ResolveLibraryProjectImports/>` to a common place in the `Files` class so it can also be used by the `<CreateLibraryResourceArchive/>` MSBuild task. We need to use this for `.aar` files *only*, because `.zip` files could be *any* format. I brought over Brendan's test that reproduces the bug as well. Co-authored-by: Brendan Zagaeski <brzaga@microsoft.com>
…p) (#4982) Fixes: #4565 Context: #4565 (comment) In f230b87, I fixed `lint.jar` from being included in apps from the `@(AndroidAarLibrary)` item group. Unfortunately, this did not fix the scenario for `@(LibraryProjectZip)` in binding projects! I moved the `skipCallback` used in the `<ResolveLibraryProjectImports/>` to a common place in the `Files` class so it can also be used by the `<CreateLibraryResourceArchive/>` MSBuild task. We need to use this for `.aar` files *only*, because `.zip` files could be *any* format. I brought over Brendan's test that reproduces the bug as well. Co-authored-by: Brendan Zagaeski <brzaga@microsoft.com>
Thanks for fixing, can you also update this with a release status?As in which release will have the fix @brendanzagaeski |
Thanks for the question! So far, the new fix for this item is only present on the master development branch, so I will set the milestone to d16-9 for now to match the next xamarin-android development branch that will be created from master. By default, that branch will align with the Visual Studio 2019 version 16.9 and Visual Studio 2019 for Mac version 8.9 releases. I'll watch to see if this fix is backported to another development branch, such as d16-8, and update the milestone again if it is. The new Release status update comments will come later, when the fix is formally available in a published version of Visual Studio. |
…p) (#4982) Fixes: #4565 Context: #4565 (comment) In f230b87, I fixed `lint.jar` from being included in apps from the `@(AndroidAarLibrary)` item group. Unfortunately, this did not fix the scenario for `@(LibraryProjectZip)` in binding projects! I moved the `skipCallback` used in the `<ResolveLibraryProjectImports/>` to a common place in the `Files` class so it can also be used by the `<CreateLibraryResourceArchive/>` MSBuild task. We need to use this for `.aar` files *only*, because `.zip` files could be *any* format. I brought over Brendan's test that reproduces the bug as well. Co-authored-by: Brendan Zagaeski <brzaga@microsoft.com>
Release status update A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android SDK version 11.0.99.34. Fix included on Windows in Visual Studio 2019 version 16.8 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 2. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version of Xamarin.Android has now been published that includes the fix for this item. Fix included in Xamarin.Android SDK version 11.1.0.17. Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
When building a Xamarin-Android app using an AAR library that contains a
lint.jar
file, release builds fail due to Xamarin-Android trying to process thelint.jar
file using R8.Steps to Reproduce
lint.jar
file. The possibility of having alint.jar
is described here: https://developer.android.com/studio/projects/android-library#aar-contentsExpected Behavior
The release build should succeed without errors. The
lint.jar
file should be excluded from R8, as well as from any other build steps, as it is not meant to be included inside the app (it is only used by the IDE to provide linter warnings).Actual Behavior
R8 fails to minify the project's classes, because it picks up the
lint.jar
file and tries to minimize it too.I assume that this is the case, because all JAR files inside the AAR are used as library class files, and the
lint.jar
file is not properly filtered, for example here:https://github.com/xamarin/xamarin-android/blob/7249199988f42dd2f8da1035cb2e7a334f0ad28a/src/Xamarin.Android.Build.Tasks/Tasks/ResolveLibraryProjectImports.cs#L354-L358
Instead, the
lint.jar
file is only important for the IDE, and should not be included on the compile classpath or runtime classpath of the app.Version Information
Microsoft Visual Studio Community 2019
Version 16.4.5
VisualStudio.16.Release/16.4.5+29806.167
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Community
Visual C++ 2019 00435-60000-00000-AA767
Microsoft Visual C++ 2019
Microsoft Visual Studio VC Package 1.0
Mono Debugging for Visual Studio 16.5.24 (1fafd7e)
NuGet Package Manager 5.4.0
Xamarin 16.4.000.311 (d16-4@ddfd842)
Xamarin.Android SDK 10.1.4.0 (d16-4/e44d1ae)
Mono: fd9f379
Java.Interop: xamarin/java.interop/d16-4@c4e569f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b
The text was updated successfully, but these errors were encountered: