Xamarin.Android project build fails after upgrading to Visual Studio 17.3.5 (from 17.2.5) due to missing .dll in AOT folder and aapt_rules.txt #7447
Description
Android application type
Classic Xamarin.Android (MonoAndroid12.0, etc.)
Affected platform version
VS 17.3.5
Description
Not a single change in our project or CI script, just VS got update to the currently latest one and we experience 2 strange and blocker side-effect during AOT apk build, that can be strangely workaround if we get rid of those packages, but still nothing change on our side at all aside the VS update:
First:
It looks like some .dll is not getting copied/generated into the target folder anymore like Humanizer or PublicHoliday give us this error at the very end of the AOT process when it tries to zip the aot files into a zip:
"X.Android.csproj" (SignAndroidPackage target) (1) -> (_BuildApkEmbed target) -> C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error XABLD7028: Sy [MissingDllDuringAOT.zip](https://github.com/xamarin/xamarin-android/files/9745881/MissingDllDuringAOT.zip) stem.IO.FileNotFoundException: Could not find file 'X.Android\obj\DEV-Release\110\aot\arm64-v8a\libaot-PublicHoliday.dll.so'. [X.Android.csproj] C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error XABLD7028: File name: 'X.Android\obj\DEV-Release\110\aot\arm64-v8a\libaot-PublicHoliday.dll.so'
Second error that even if we get those things fixed, we get now these errors during the "startup" phase of the build that we have no idea so far why and can't even workaround it:
MSBUILD : java.exe error JAVA0000: Error in obj\Release\110\aapt_rules.txt at line 289, column 1: [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: Expected char '-' at obj\Release\110\aapt_rules.txt:289:1 [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: nit>(...); } [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: Compilation failed
I hope someone can help why these now happen and some possible workaround to fix these issues
Steps to Reproduce
I can reproduce the error by trying to build the attached MissingDllDuringAOT.zip in Release mode.
Did you find any workaround?
No response
Relevant log output
Severity Code Description Project File Line Suppression State Error XABBA7028: System.IO.FileNotFoundException: Could not find file 'C:\Users\Charlie\Downloads\MissingDllDuringAOT\MissingDllDuringAOT\MissingDllDuringAOT\obj\Release\110\aot\armeabi-v7a\libaot-Humanizer.dll.so'. File name: 'C:\Users\Charlie\Downloads\MissingDllDuringAOT\MissingDllDuringAOT\MissingDllDuringAOT\obj\Release\110\aot\armeabi-v7a\libaot-Humanizer.dll.so' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.GetAttributes(String path) at Xamarin.Tools.Zip.WindowsPlatformServices.IsDirectory(ZipArchive archive, String path, Boolean& result) in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/WindowsPlatformServices.cs:line 47 at Xamarin.Tools.Zip.PlatformServices.CallServices(Func
2 code) in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/PlatformServices.cs:line 166
at Xamarin.Tools.Zip.PlatformServices.IsDirectory(ZipArchive archive, String path) in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/PlatformServices.cs:line 74
at Xamarin.Tools.Zip.ZipArchive.AddFile(String sourcePath, String archivePath, EntryPermissions permissions, CompressionMethod compressionMethod, Boolean overwriteExisting) in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs:line 406
at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary2 compressedAssembliesInfo, String assemblyStoreApkName) at Xamarin.Android.Tasks.BuildApk.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 0 _No response_
Activity