-
Notifications
You must be signed in to change notification settings - Fork 533
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
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
Comments
Hi, The second error seems to be related to the Can you provide a diagnostic build log which contains the error ? This can be done on the Visual Studio Developer Command Prompt. You can navigate to your project directory then use
This will produce a |
Hi @vilinet. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@dellis1972 Until that, This issue happens in release only anyway and we always build with cleaned/removed bin/obj dirs. This is the Android.csproj related section: |
Regarding the missing AOT-d dlls, i noticed that the 2 libs we have issues with, Humanizer and PublicHoliday, both uses local-dependent nuget packages as dependencies. |
I managed to reproduce the AOT dll problem with a sample project that i attached and added to the "Reproduce" section also the exact error message to the "Relevent Log output" |
Hi @vilinet. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @vilinet. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you. |
[Updated] Here is the .binlog for the missing dll problem during AOT: Detailed build log: Video about the error: Also we noticed that during AOT, the build output shows this (at ~18seconds in the video) or look at the build log. But we think these error blocking the AOT .dll from being generated: [aot-compiler stderr] obj\Release\110\aot\arm64-v8a\Humanizer.dll\temp.s:77327:84: error: unexpected token in directive |
@dellis1972 Hi, could you re-open the ticket please? Sorry for the late .binlog but there it is. Just as an example solution to reproduce the problem. |
Regarding the AAPT2 error, here is a video of the AAPT 2 error with a fresh, clean build and the regarding binlog files: aapt_error.mp4It really looks like the aap rules files is not getting flushed properly during generation and the lines getting scrambled |
vs 17.4.1 - issue still persists |
I tried the project above, and I'm not hitting an issue with
It looks like the core problem is that Mono's AOT compiler is having an issue with Humanizer:
It looks like the "B" here is some unicode character: GitHub can't even render it here: So to look into this further:
If the problem happens in .NET 6+, we will have an easier time reporting an issue for the AOT compiler and getting it fixed. |
Hi @vilinet. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@jonathanpeppers , try remove bin and obj folders and then Rebuild project. Not Build or Deploy. If I use Build, projects builds successfully. |
@melimion I think this is related to the I think whats happening is multiple calls to |
@dellis1972 looks like you're right, 5 rebuilds with |
@melimion ok cool good to know, I'm working on a fix 👍 |
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` 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 ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` 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 ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` 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 ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` 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 ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` 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 ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
Fixes: #7447 Users are reporting a error with the aapt_rules file generated by aapt2 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 This only happens when building with `$(AndroidCreatePackagePerAbi)`=True. After looking at the code: 1. we call `aapt2 link` multiple times when building per abi 2. the temp file used for the `aapt2 link` proguard output was the same file for *all* of the `aapt2 link` calls. The combination of (1) and (2) can result in one call to `aapt2` overwriting the previous `aapt2` invocation results, or (worse) leaving garbage at the end of the file. results... or worse leaving garbage at the end. Fix this by providing a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
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 166at 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, IDictionary
2 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_
The text was updated successfully, but these errors were encountered: