Skip to content

[BUG] Camera View - Zoom does not work when application is built in release mode  #2109

Closed

Description

@LHunter91

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When built in release mode there is no way to zoom the camera view - while all tried methods work perfectly in debug mode

Expected Behavior

Zoom to work in both release and debug

Steps To Reproduce

Run attached code base, set to release mode and deploy to an android device, press the zoom button to see nothing happens

How ever when deployed in debug mode it works

Link to public reproduction project repository

https://github.com/jfversluis/MauiCameraViewSample

Environment

- OS: Andorid
- .NET MAUI:

Anything else?

No response

Activity

  1. soroushsarabi commented on Aug 15, 2024

    @soroushsarabi

    I have same issue

  2. AmenehShadlo commented on Aug 15, 2024

    @AmenehShadlo

    I have same issue, any solution?

  3. nk-alex commented on Aug 20, 2024

    @nk-alex

    Same issue here

  4. AugPav commented on Aug 20, 2024

    @AugPav

    Same problem in release. We tested it in our own development, and added a DisplayAlert to the zoom in/out button to verify that the button worked. The display looks perfect but the zoom doesn't work.

  5. LHunter91 commented on Aug 27, 2024

    @LHunter91
    Author

    Issue still not fixed in Nuget Version 1.0.4 MCT.Maui.Camera

  6. jaqsilva commented on Aug 27, 2024

    @jaqsilva

    im having the same problem. It seems to me that the MaxZoomFactor is always 1. Somehow i can zoom on the front camera where MaxZoomFactor is not set to 1 but on the rear camera its always 1.

    Edit: i've realised that i can zoom in both cameras in debug. the problem is when i have the emulator camera set to "virtual" instead of "emulated" i cant zoom in debug. Now i can zoom in both camera in debug, but when i deploy to release i cant zoom in none of them.

    "My Resolution": Not the optimal scenario but if you disable AoT compilation and code trimming for release you can zoom after the deploy.

  7. bijington commented on Aug 28, 2024

    @bijington
    Contributor

    @jaqsilva thank you for that update! It sounds like something is being trimmed out of your application when being built. We currently have IsTrimmable set to false in our projects because we aren't fully compliant with it - we hope to be when .NET 9 ships though. This makes me believe it is the AoT compilation that would be causing it as the code shouldn't be trimmed.

  8. AugPav commented on Sep 16, 2024

    @AugPav

    @jaqsilva thank you for that update! It sounds like something is being trimmed out of your application when being built. We currently have IsTrimmable set to false in our projects because we aren't fully compliant with it - we hope to be when .NET 9 ships though. This makes me believe it is the AoT compilation that would be causing it as the code shouldn't be trimmed.

    Thanks!

  9. cam13469 commented on Oct 1, 2024

    @cam13469

    This is also an issue for my team. Just commenting to give the issue a bit more attention.

  10. Xopabyteh commented on Oct 1, 2024

    @Xopabyteh

    This is a huge deal for our project. Not being able to publish with AOT and trimmed makes the app bloated and very unoptimized.

    Workaround

    Update the CSPROJ file to disable Trimming and AOT:

            <PublishTrimmed>false</PublishTrimmed>
            <PublishAot>false</PublishAot>
            <RunAOTCompilation>false</RunAOTCompilation>
  11. bijington commented on Oct 2, 2024

    @bijington
    Contributor

    I've had a brief look at this but I have only been able to test using an emulator which doesn't support zooming.

  12. AndrewKeat commented on Oct 7, 2024

    @AndrewKeat

    I am also having this issue with no zoom in release. It works fine for me in iOS, both debug and release. In android it works in debug, but not in release.
    When I add display information I can see minzoom=1 and maxzoom=1 in release mode. In debug minzoom=1, maxzoom=10.

  13. phunkeler commented on Oct 27, 2024

    @phunkeler
    Contributor

    I recently encountered this issue and found that excluding just the Xamarin.AndroidX.Camera.Core assembly from the trimming process is enough to get zoom working in a release build of our app.

    MauiApp.csproj

    <ItemGroup Condition="$(TargetFramework.Contains('-android'))">
        <TrimmerRootDescriptor Include="Platforms\Android\ILLink.Descriptors.xml" />
    </ItemGroup>

    MauiApp\Platforms\Android\ILLink.Descriptors.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <linker>
        <assembly fullname="Xamarin.AndroidX.Camera.Core" />
    </linker>
  14. AndrewKeat commented on Oct 29, 2024

    @AndrewKeat

    Thanks for the suggestion phunkeler. Unfortunately it did not work for me. In the end I modified the ILLinker.Descriptors.xml file as follows and it worked.

    <?xml version="1.0" encoding="UTF-8" ?>
    <linker>
    	<assembly fullname="Xamarin.AndroidX.Camera.Core" />
    	<assembly fullname="Xamarin.AndroidX.Camera.Lifecycle" />
    	<assembly fullname="Xamarin.AndroidX.Camera.Video" />
    	<assembly fullname="Xamarin.AndroidX.Camera.View" />
    	<assembly fullname="Xamarin.AndroidX.Camera.Camera2" />
    </linker>
    
  15. added a commit that references this issue on Nov 5, 2024
  16. locked and limited conversation to collaborators on Dec 19, 2024
  17. added a commit that references this issue on Mar 17, 2026
  18. added a commit that references this issue on Oct 23, 2026
    e600d21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Camera 📸Issue/PR associated with the Camera packagebugSomething isn't workingunverified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions