Skip to content
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

Maui(7.0) Android AOT Compile Error #8252

Closed
pulmuone opened this issue Aug 8, 2023 · 13 comments
Closed

Maui(7.0) Android AOT Compile Error #8252

pulmuone opened this issue Aug 8, 2023 · 13 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@pulmuone
Copy link

pulmuone commented Aug 8, 2023

Android application type

Not applicable

Affected platform version

vs2022 maui .net7 android aot compile error.

Description

maui(.net7) An error occurs when you compile aot on Android.

Steps to Reproduce

1.Maui
2.Android
3.Release Mode
4.build

Did you find any workaround?

No response

Relevant log output

Error		Precompiling failed for D:\01.SourcePrivate\BarcodeScanner4Maui#3\BarcodeScanner\BarcodeScanner\obj\Release\net7.0-android33.0\android-arm64\linked\Microsoft.Maui.Controls.dll with exit code 1.
Failed to load method 0x6002df6 from 'D:\01.SourcePrivate\BarcodeScanner4Maui#3\BarcodeScanner\BarcodeScanner\obj\Release\net7.0-android33.0\android-arm64\linked\Microsoft.Maui.Controls.dll' due to Could not resolve type with token 01000245 from typeref (expected class 'AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper' in assembly 'Xamarin.AndroidX.AppCompat.AppCompatResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Xamarin.AndroidX.AppCompat.AppCompatResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper member:(null).
Mono Ahead of Time compiler - compiling assembly D:\01.SourcePrivate\BarcodeScanner4Maui#3\BarcodeScanner\BarcodeScanner\obj\Release\net7.0-android33.0\android-arm64\linked\Microsoft.Maui.Controls.dll
Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.86\Sdk\maui.aotprofile'
Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.86\Sdk\maui-blazor.aotprofile'
Run with MONO_LOG_LEVEL=debug for more information.
AOT of image obj\Release\net7.0-android33.0\android-arm64\linked\Microsoft.Maui.Controls.dll failed.	BarcodeScanner	C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.46\targets\Microsoft.Android.Sdk.Aot.targets	91
@jpobst jpobst transferred this issue from xamarin/AndroidX Aug 8, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issues that need to be assigned. label Aug 8, 2023
@jpobst
Copy link
Contributor

jpobst commented Aug 8, 2023

@jonathanpeppers @dellis1972
I'm not sure if we want to look at this in XA, or pass it to MAUI or Mono. I am pretty sure this is an AOT issue and not caused by AndroidX itself.

@jonathanpeppers
Copy link
Member

@pulmuone can you share an MSBuild .binlog of the failure? https://aka.ms/binlog

@jonathanpeppers jonathanpeppers added need-info Issues that need more information from the author. and removed needs-triage Issues that need to be assigned. labels Aug 8, 2023
@jonathanpeppers jonathanpeppers added this to the Under Consideration milestone Aug 8, 2023
@microsoft-github-policy-service
Copy link
Contributor

Hi @pulmuone. 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.

@pulmuone
Copy link
Author

pulmuone commented Aug 11, 2023

@pulmuone can you share an MSBuild .binlog of the failure? https://aka.ms/binlog

add file "out.binlog"
out.zip

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention A xamarin-android contributor needs to review and removed need-info Issues that need more information from the author. labels Aug 11, 2023
@jonathanpeppers
Copy link
Member

The .binlog above is from a Debug build and has no error inside. Do you need to share a log from a Release build instead?

I suspect your locale could be related to the problem, as the MSBuild .binlog viewer even has trouble opening this:

image

@dellis1972
Copy link
Contributor

This is a known issue see #7710.
Using non-ASCII characters for project names or in the full path to the project can cause both the AOT compiler and the google tools (like aapt2) to fail.

@pulmuone
Copy link
Author

This is a known issue see #7710. Using non-ASCII characters for project names or in the full path to the project can cause both the AOT compiler and the google tools (like aapt2) to fail.

Same if I change the folder name.
D:\Project\BarcodeScanner4Maui3

@pulmuone
Copy link
Author

I re-added the Release option to generate logs.
msbuild.exe BarcodeScanner.sln /bl:out.binlog -p:Configuration=Release
outlog#2.zip

@jonathanpeppers
Copy link
Member

This looks like the same API that moved from one package to another here: xamarin/AndroidX#690 (comment)

Precompiling failed for D:\Project\BarcodeScanner4Maui3\BarcodeScanner\obj\Release\net7.0-android33.0\android-arm\linked\Microsoft.Maui.Controls.dll with exit code 1.
Failed to load method 0x6002df9 from 'D:\Project\BarcodeScanner4Maui3\BarcodeScanner\obj\Release\net7.0-android33.0\android-arm\linked\Microsoft.Maui.Controls.dll' due to Could not resolve type with token 01000245 from typeref (expected class 'AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper' in assembly 'Xamarin.AndroidX.AppCompat.AppCompatResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Xamarin.AndroidX.AppCompat.AppCompatResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper member:(null).

@jpobst have you seen this issue in a .NET 7 app?

@jpobst
Copy link
Contributor

jpobst commented Aug 14, 2023

I don't think I've seen this in a MAUI app, all the other reports were from Xamarin.Forms/Classic.

However, it does look like MAUI was on the old version (1.5.*) previously at some point: dotnet/maui@d3f78c8.

So it could happen there too I guess.

@pulmuone
Copy link
Author

pulmuone commented Aug 17, 2023

https://github.com/sasa-bobic/Xamarin.AndroidX.AppCompat.AppCompatResources
I solved it with this content.
Is it resolved in Maui .net8 Android?

@pulmuone
Copy link
Author

xamarin/AndroidX#775

Maui (net 7) Is this also resolved on Android?

@jpobst jpobst added Area: App+Library Build Issues when building Library projects or Application projects. and removed need-attention A xamarin-android contributor needs to review labels Mar 20, 2024
@jpobst
Copy link
Contributor

jpobst commented May 17, 2024

This should be fixed in newer versions of MAUI.

@jpobst jpobst closed this as completed May 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

No branches or pull requests

4 participants