Repository navigation
Android - APT2000 build error when maui-blazor #7639
Description
Activity
- addedArea: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.needs-triageIssues that need to be assigned.Issues that need to be assigned.
on Dec 15, 2022 As per the other bug can you add the following to your project
<AndroidAapt2LinkExtraArgs>$(AndroidAapt2LinkExtraArgs) -v</AndroidAapt2LinkExtraArgs>then build (from clean) on the command line again and post the logs? We need the binlog file
so you need to rundotnet build MyCompanyName.MyProjectName.MauiBlazor.csproj -blThis will give us more verbose
aapt2output. It should help narrow down which file is causing the error.On a side note, the path you have
D:\ci\Jenkins\workspace\abp-commercial-nightly\volo\abp\templates\app-pro\aspnet-core\src\MyCompanyName.MyProjectName.MauiBlazor\MyCompanyName.MyProjectName.MauiBlazor.csprojmight cause some issues on windows. Windows has a max command line length which you might hit when building release builds with aot.- addedneed-infoIssues that need more information from the author.Issues that need more information from the author.and removedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Dec 15, 2022 - ghost removedneed-infoIssues that need more information from the author.Issues that need more information from the author.
on Dec 15, 2022 - ghost addedneed-attentionA xamarin-android contributor needs to reviewA xamarin-android contributor needs to review
on Dec 15, 2022 I'm not seeing anyting obvious in the logs.
aapt2is raising that error, but its not reporting which file it cannot find.
I will try to repo here (not luck so far).Are you getting this on a maui-blazor template? If so can you zip up the entire project and attach it to this issue please?
- addedneed-infoIssues that need more information from the author.Issues that need more information from the author.and removedneed-attentionA xamarin-android contributor needs to reviewA xamarin-android contributor needs to review
on Dec 15, 2022 this problem is related to Windows long path. but the error message that
aapt2is rasing is not clear. developers can easily fall into this issue, so we should find a way to expose this exception.Reacted by selman koc- ghost removedneed-infoIssues that need more information from the author.Issues that need more information from the author.
on Dec 16, 2022 - ghost addedneed-attentionA xamarin-android contributor needs to reviewA xamarin-android contributor needs to review
on Dec 16, 2022 It might also be worth looking at some of the suggestions in https://learn.microsoft.com/en-us/xamarin/android/troubleshooting/questions/path-too-long-exception and see if they work.
Setting a shorter
BaseIntermediateOutputPath(and leaving the project where it is) might also help.
You will need to place this in aDirectory.Build.propsfile next to your project/solution.<Project> <PropertyGroup> <BaseIntermediateOutputPath Condition=" '$(OS)' == 'Windows_NT' ">C:\Intermediate\$(ProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition=" '$(OS)' != 'Windows_NT' ">/tmp/Intermediate/$(ProjectName)</BaseIntermediateOutputPath> </PropertyGroup> </Project>It might also be worth looking at some of the suggestions in https://learn.microsoft.com/en-us/xamarin/android/troubleshooting/questions/path-too-long-exception and see if they work.
Setting a shorter
BaseIntermediateOutputPath(and leaving the project where it is) might also help. You will need to place this in aDirectory.Build.propsfile next to your project/solution.<Project> <PropertyGroup> <BaseIntermediateOutputPath Condition=" '$(OS)' == 'Windows_NT' ">C:\Intermediate\$(ProjectName)</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition=" '$(OS)' != 'Windows_NT' ">/tmp/Intermediate/$(ProjectName)</BaseIntermediateOutputPath> </PropertyGroup> </Project>Thanks.
Directory.Build.propsfile worked!Excelent.
While we cannot fix the error in
aapt2I did open a PR which should improve the error messaging a bit #7644.Reacted by selman koc- ghost locked as resolved and limited conversation to collaborators
on Jan 15, 2023
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.NET 7.0.100
Description
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.4\tools\Xamarin.Android.Aapt2.targets(212,3): error APT2000: The system cannot find the file specified. (2). [D:\ci\Jenkins\workspace\abp-commercial-nightly\volo\abp\templates\app-pro\aspnet-core\src\MyCompanyName.MyProjectName.MauiBlazor\MyCompanyName.MyProjectName.MauiBlazor.csproj::TargetFramework=net7.0-android]I am facing this error when build Maui-Blazor project.
I updated all related SDK but problem continues.
This issue is not related #6925.
Steps to Reproduce
dotnet new maui-blazor
dotnet build
Did you find any workaround?
No response
Relevant log output
No response