Replies: 1 comment 2 replies
-
|
@MCutrin let me know which step would you like to take to test and I can help you with help/guidance. CoPilot: Here’s what’s going on and how to fix it: 🔹 Why it happens The CameraView control relies on reflection and generated XAML bindings, which the linker doesn’t always recognize as “in use.” As a result, required types or members get removed, so when InitializeComponent() runs, it can’t find what it needs → crash before your code executes. This matches exactly what your adb logcat showed: the failure happens inside MainPage.InitializeComponent. 🔹 Fixes / Workarounds
Update your .csproj to relax linking In your .csproj, under the Android/iOS property groups, try: xml This disables aggressive stripping. If this fixes it, you can then re‑enable linking selectively with a linker.xml file. Use a linker.xml file Create a linker.xml in your project root: xml Then in .csproj: xml This tells the linker to keep everything in that assembly. Check package version Make sure you’re on the latest CommunityToolkit.Maui.Camera. There have been fixes related to Release builds. The GitHub discussion confirms this exact issue is being tracked. ✅ Bottom line |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone, and thank you in advance for taking the time to read my question.
I have a situation I can’t seem to resolve with the MAUI Toolkit CameraView package, so I’m hoping someone from this community might be able to help me.
Here’s the issue: I’m using the CommunityToolkit.Maui.Camera package to have a constant camera feed and take pictures. I’ve set everything up correctly, and this part of the app works perfectly in Debug mode, both on iOS and Android. However, when running the app in Release mode on either platform, trying to access the page where the CameraView starts does nothing. The app doesn’t crash, no error appears—simply, when pressing the button that in Debug opens the CameraView page, nothing happens.
Given this, and after searching for information about the problem, I tried several configuration changes in the .csproj file, such as disabling the linker, changing the AOT mode, disabling R8 in Android, etc., but none of them worked.
I also created a test project where the only thing I added was the CommunityToolkit.Maui.Camera package in the main page, just to rule out issues in my full project (like incompatibilities that could be breaking the CameraView). But with this “blank” project the same thing happens: in Debug the app runs without issues and the CameraView is shown as soon as the app starts, but in Release mode, after the splash screen, the app closes automatically.
I’m linking that test project here so the issue can be reproduced.
As a last attempt to figure out what’s happening, I ran an
adb logcatanalysis at the moment of the crash, but the only relevant info I found was:I wasn’t able to interpret whether this points to the root cause.
According to ChatGPT (since I don't have the knowledge to interpret this information), the crash happens before my C# code executes, so it's not permissions or initialization: it's that the linker/AOT has removed or modified something that the XAML expects to find.
If anyone has experienced this issue (or something similar), I’d really appreciate any help or guidance.
Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions