dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.74k forks source link

.NET MAUI does not work with Android 13 Android.permission.write_external_storage #11275

Closed FatCodeMonkey closed 1 year ago

FatCodeMonkey commented 1 year ago

Description

My App was working and able to take pictures on Android 12 and .NET 6 but as soon as I upgraded to Android 13 and .NET 7, it stopped working. When I call this method:

FileResult photo = await MediaPicker.Default.CapturePhotoAsync();

I get this error: Microsoft.Maui.ApplicationModel.PermissionException: 'StorageWrite permission was not granted: Denied'.

I do have these declarations in the AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<queries>
    <intent>
        <action android:name="android.media.action.IMAGE_CAPTURE" />
    </intent>
</queries>

Steps to Reproduce

  1. Create a new .NET MAUI App with the default template (not empty template).
  2. Replace the code in the OnCounterClicked method with the code below.
  3. Connect your device to your PC (my device is Google Pixel Pro 6).
  4. Run (Debug) the app on the local Android 13 device.
  5. Click the Counter button
  6. Notice the error

Link to public reproduction project repository

https://github.com/FatCodeMonkey/MAUIPhoto

Version with bug

6.0.486 (current)

Last version that worked well

6.0.424

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

No

Relevant log output

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C#
    0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C#
    0x1D in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:23,26    C#
    0x17 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw    C#
    0x6 in System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0 C#
    0xC in Android.App.SyncContext. at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36,19 C#
    0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6 C#
    0x8 in Java.Lang.IRunnableInvoker.n_Run at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net6.0/android-33/mcw/Java.Lang.IRunnable.cs:84,4    C#
    0x8 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:22,5  C#
UkeHa commented 1 year ago

@FatCodeMonkey does it work if you add android:requestLegacyExternalStorage="true" to your manifest? <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:requestLegacyExternalStorage="true">>

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

PureWeen commented 1 year ago

@mattleibow @rachelkang

Stedy59 commented 1 year ago

What baffles me, is that .net MAUI was released with an initial target Android API of 33. But the underlying code does not support Android API 33!

Starting from Android 13, if your application target SDK is specified to 33 or above, the READ_EXTERNAL_STORAGE permission will be completely useless, and applying for it will have no effect.

Correspondingly, Google has added three runtime permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO, which are used to manage the photos, videos and audio files of the phone respectively. That is to say, in the past, you only needed to apply for a READ_EXTERNAL_STORAGE permission. This is no longer possible. You have to apply for it on demand, so that users can learn more precisely which media permissions your app has applied for.

<manifest>
    <!-- Required only if your app targets Android 13. -->
    <!-- Declare one or more the following permissions only if your app needs
    to access data that's protected by them. -->
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

    <!-- Required to maintain app compatibility. -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
                     android:maxSdkVersion="32" />

</manifest>

It is the same for notifications!

<manifest >
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

</manifest>

I pulled the Android permissions code, and updated it to support API 33. Hopefully they will realize that making the "Essentials" an actual part of the MAUI core, requires a higher level of attention to external API changes.

@PureWeen @UkeHa

sidewinder94 commented 1 year ago

@Stedy59 Could you share your modifications while we wait for the MAUI team to fix this ? (right now as a workaround I fixed the target android sdk to 30 in the android manifest).

YMichurin commented 1 year ago

I do not see how I can circumvent the issue either. Everyone around me has devices with the latest Android installed which I can't run my .net maui app on. The app can't work without media picker (MediaPicker control), but it seems to rely on WRITE_EXTERNAL_STORAGE only, which is not in the list of android permissions anymore. It does not care about new api 33 permissions like READ_MEDIA_IMAGES, it wants WRITE_EXTERNAL_STORAGE and does not run camera without it. Am I stuck till the issue is fixed in new ver of .net maui core, or there is some temp. workaround for that?

sidewinder94 commented 1 year ago

@YMichurin Unless you need what api 33 need, change the target SDK inside the android manifest to target api level 32. That did it for me

YMichurin commented 1 year ago

hi @sidewinder94, if I do change the manifest to api 32 and let's say I do not use api 33 features, would my app work on a phone with the newest api 33 installed?

Stedy59 commented 1 year ago

Here is a snippet that I use to open the device gallery and/or select a ringtone...

[assembly: UsesPermission(Name = "android.permission.READ_EXTERNAL_STORAGE", MaxSdkVersion = 32)]
[assembly: UsesPermission(Name = "android.permission.READ_MEDIA_AUDIO")]
[assembly: UsesPermission(Name = "android.permission.READ_MEDIA_IMAGES")]
[assembly: UsesPermission(Name = "android.permission.READ_MEDIA_VIDEO")]
namespace StedySoft.Shared {

    #region Class MediaServices
    public static partial class MediaServices {

        #region Declarations
        internal const int OPENGALLERY = 100;
        internal const int OPENRINGTONES = 101;
        #endregion

        #region Private Methods
        private static bool PlatformGetExternalStoragePermissions(string requestMessage, int permissionType = OPENGALLERY) {
            try {
                Permission status = Permission.Denied;
                if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu) {
                    switch (permissionType) {
                        case OPENGALLERY:
                            status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadMediaImages);
                            break;
                        case OPENRINGTONES:
                            status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadMediaAudio);
                            break;
                    }
                }
                else {
                    status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadExternalStorage);
                }
                if (status != Permission.Granted) {
                    if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu) {
                        switch (permissionType) {
                            case OPENGALLERY:
                                if (ActivityCompat.ShouldShowRequestPermissionRationale(Platform.Activity, Manifest.Permission.ReadMediaImages)) { Toast.Show(requestMessage, ToastDuration.Long); }
                                ActivityCompat.RequestPermissions(Platform.Activity, new[] { Manifest.Permission.ReadMediaImages }, 0);
                                break;
                            case OPENRINGTONES:
                                if (ActivityCompat.ShouldShowRequestPermissionRationale(Platform.Activity, Manifest.Permission.ReadMediaAudio)) { Toast.Show(requestMessage, ToastDuration.Long); }
                                ActivityCompat.RequestPermissions(Platform.Activity, new[] { Manifest.Permission.ReadMediaAudio }, 0);
                                break;
                        }
                    }
                    else {
                        if (ActivityCompat.ShouldShowRequestPermissionRationale(Platform.Activity, Manifest.Permission.ReadExternalStorage)) { Toast.Show(requestMessage, ToastDuration.Long); }
                        ActivityCompat.RequestPermissions(Platform.Activity, new[] { Manifest.Permission.ReadExternalStorage }, 0);
                    }
                    Stopwatch stopwatch = new();
                    stopwatch.Start();
                    do {
                        Thread.Sleep(10);
                        if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu) {
                            switch (permissionType) {
                                case OPENGALLERY:
                                    status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadMediaImages);
                                    break;
                                case OPENRINGTONES:
                                    status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadMediaAudio);
                                    break;
                            }
                        }
                        else {
                            status = ContextCompat.CheckSelfPermission(Application.Context, Manifest.Permission.ReadExternalStorage);
                        }
                        if (stopwatch.ElapsedMilliseconds > 10000) {
                            throw new Exception("Timed out waiting for permission.");
                        }
                    } while (status != Permission.Granted);
                }
                return true;
            }
            catch (Exception ex) {
                Logger.LogException("MediaServices", "PlatformGetExternalStoragePermissions", ex);
            }
            return false;
        }
sidewinder94 commented 1 year ago

@YMichurin Yes, no issues there, since devices running higher versions know how to deal with older ones.

espenrl commented 1 year ago

And here is the code

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="32" />
FM1973 commented 1 year ago

Same here. I had to set the targetSdkVersion to 32 to use Notifications. A lot of people already user Android 13. It would be nice to have the new permissions implemented in Maui.

HopInTheCloud commented 1 year ago

I have the same issue. The question now is, how long will it take for them to release an update to fix this. Releasing updates seems to be taking a really long time.

espenrl commented 1 year ago

I avoided this issue by using Xamarin.MediaGallery instead.

https://github.com/dimonovdd/Xamarin.MediaGallery

symbiogenesis commented 1 year ago

I avoided this issue by using Xamarin.MediaGallery instead.

https://github.com/dimonovdd/Xamarin.MediaGallery

I tried this, and followed the readme file, with both the stable and preview release, but it just pops up a dialog saying "Can't connect to the camera" in the Android 13 Emulator with SDK level 33.

Are you on .NET6 like the sample? Is there some other trick to it?

UkeHa commented 1 year ago

@symbiogenesis, again, if you don't need to target sdk33 just target 32 and it'll work just fine. Still a bug that needs to be fixed.

symbiogenesis commented 1 year ago

@symbiogenesis, again, if you don't need to target sdk33 just target 32 and it'll work just fine. Still a bug that needs to be fixed.

Thank you. I had tried this before and it didn't work for some reason, but I tried it now and it works. This is the best solution.

davispalla commented 1 year ago

I'm having the same problem. I'm following the colleague's last suggestion, that is, changing the destination to sdk 32. Previously, I had used Xam.Media.Plugin, however, when I open the camera, vs closes and the app in debug mode also closes without throwing the error message.

Ghostbird commented 1 year ago

@FatCodeMonkey does it work if you add android:requestLegacyExternalStorage="true" to your manifest? <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:requestLegacyExternalStorage="true">>

After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag. [source]

So no, that's a completely different option that only worked before Android 11.

Ghostbird commented 1 year ago

And here is the code

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="32" />

How do you get that to work? If I do that I get:

warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '32' is less than $(TargetFrameworkVersion) ''. Using API-33 for ACW compilation. 

@espenrl The compilation still happens with API 33 and the MediaPicker.Capture methods won't work.

Because the warning mentions $(TargetFrameworkVersion), I tried adding a TargetFrameworkVersion option with value 32 to the build, but that didn't change a thing.

YMichurin commented 1 year ago

And here is the code

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="32" />

How do you get that to work? If I do that I get:

Double check that Targeting Android option is on in the project settings and it targets lower version. This is what I have in the project file and it works. I do not think you need anything else behind that to avoid the error

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
Ghostbird commented 1 year ago

And here is the code

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="32" />

How do you get that to work? If I do that I get:

Double check that Targeting Android option is on in the project settings and it targets lower version. This is what I have in the project file and it works. I do not think you need anything else behind that to avoid the error

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>

Hmm… yes, that option is already in our csproj file, it's needed to build Android. This sets the minSdkVersion.

symbiogenesis commented 1 year ago

I just ignored the XA4211 warning. It worked. I took photos successfully on Android 13, both with the real device and the emulator.

I think your PR is still very helpful, and I hope you continue to clean up that horrible code.

The iOS code is possibly even worse. The photos don't respect the device orientation, and it is using obsolete APIs with lots of TODOs and pragmas in the code.

Ghostbird commented 1 year ago

I just ignored the XA4211 warning. It worked. I took photos successfully on Android 13, both with the real device and the emulator.

I tried, but the message is on point. It's still built using API 33 and therefore the error still occurs. Is it possible you ignored a similar, but different, warning?

symbiogenesis commented 1 year ago

I still have that warning in my code right now, and it is the only one. Thinking again, I think it is possible that I only verified it using the emulator, and took the device photos with an ipad.

I recently had tried switching to the Xamarin.MediaGallery nuget package (with MAUI support) because of a different ios camera bug regarding device orientation data not getting saved in the EXIF metadata. It seemed to have some recent work done for Android 13 compatibility as well, so it seemed promising.

That completely didn't work for me at all, so I tried switching back to MAUI essentials plus a workaround, and that seems to have fixed ios. But the Android version isn't even launching now on a real device with a published app in Release mode. So I cannot really verify anything about this right now, except to say that it is working perfect in the emulator for Android SDK 33

image .

symbiogenesis commented 1 year ago

Actually, I'm now seeing 3 warnings in the error list

image

Ghostbird commented 1 year ago

I do see those too, note that the third error seems to be a re-parse of the second one, where the Code is parsed separately from the Description by Visual Studio. I'm just seeing the two unique warnings.

Ghostbird commented 1 year ago

Ok, I managed to find it, and it has to do with a really unexpected twist in how certain values in the android manifest are applied.

I followed this thread, and applied appropriate changes to the manifest, such as the relevant parts of this comment and this comment.

Therefore my android manifest ended up with these two lines (other lines omitted):

  <uses-sdk android:minSdkVersion="21"
    android:targetSdkVersion="32" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 
    android:maxSdkVersion="32" />

This seems correct. I want to build with support for API 21 - 32, and on all those API versions WRITE_EXTERNAL_STORAGE exists, is required, and is requested. If I ever upgrade to building for API 33, WRITE_EXTERNAL_STORAGE should not be requested for that API 33 version, because it doesn't exist in API 33.

In this case I set android:targetSdkVersion="32", and I get the warning that it compiles with API 33 after all. Apparently this means that the uses-permission is omitted, because we're at API 33. If I remove the android:maxSdkVersion attribute from the uses-permission line, I still build API 33 according to the warning, but now suddenly uses-permission does work correctly, even though that permission doesn't even exist in API 33.

I'm baffled, yet happy that our release-blocker can be bypassed this way.

ejboustany commented 1 year ago

<?xml version="1.0" encoding="utf-8"?>

This is how my AndroidManifest.xml looks like and its still not working any ideas?

Ghostbird commented 1 year ago
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.CAMERA" />

<queries>
  <intent>
      <action android:name="android.media.action.IMAGE_CAPTURE" />
  </intent>
</queries>

This is how my AndroidManifest.xml looks like and its still not working any ideas?

You haven't yet told us what you're trying to do. What exactly is not working? Are you trying to take a picture on Android 13? Then reread this thread, because that's discussed quite extensively. You can remove the READ_MEDIA permissions, since taking pictures is not about reading, but writing. Then you'll need:

  <uses-sdk android:minSdkVersion="21"
    android:targetSdkVersion="32" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"  />

Although you may use a different minSdkVersion.

Keep in mind that this is not necessary because of Android, but because of a bug in MAUI. Once #12766 is merged and a new MAUI version is released, it's no longer necessary.

ejboustany commented 1 year ago

I have added that before it didn't work for some reason. When I removed the READ_MEDIA permissions its not working. Thanks for the help. Yes I was trying to capture images on Android 13. That was my first time asking a question on GitHub and looks like ill be doing it more now. Happy to join the MAUI community.

AHComp commented 1 year ago
        public async Task SaveMediaAsync(byte[] data, string name, string location = "EsiMedias")
        {
            var documentsPath = Environment.GetExternalStoragePublicDirectory(Environment.DirectoryPictures)?.Path;
            if (documentsPath != null)
            {
                documentsPath = System.IO.Path.Combine(documentsPath, location);
                Directory.CreateDirectory(documentsPath);

                var filePath = System.IO.Path.Combine(documentsPath, name);

                await File.WriteAllBytesAsync(filePath, data);
            }
        }

If i try to override a file it was not working and i got a access denied message !

I used the workaround with api 32 in manifest.

So creating of the file was working but not override !

if i delete before it works !

                if (File.Exists(filePath))
                    File.Delete(filePath);
joseluisct commented 1 year ago

Same problem here, using the workaround and now it's working with Android 13 device/emulator. Waiting for the update to target again android 13. Thank you for the workaround!

guillaumedotnet commented 1 year ago

Hi there, I'm glad to hear that the issue has been resolved in .NET 8 Preview 1. However, does this mean that the fix will not be included in a service release before the stable version of .NET 8 is released? Thanks for the information 🙏.

Ghostbird commented 1 year ago

If you check the links above where this issue is mentioned, you may find this answer to your question.

In summary, it just barely missed the previous .NET 7 service release, and it will be in the upcoming one.

guillaumedotnet commented 1 year ago

Very clear, thank you! Hopefully soon 🤞

samirgcofficial commented 1 year ago

Waiting for the Solution Still.

Ghostbird commented 1 year ago

Please read the thread before commenting. It contains a workaround that will tide you over, and you'll see that the fix has been incorporated into MAUI .NET 8 and .NET 7 and will be in the next release.

HurseyNZ commented 1 year ago

Please read the thread before commenting. It contains a workaround that will tide you over, and you'll see that the fix has been incorporated into MAUI .NET 8 and .NET 7 and will be in the next release.

Not to discredit what you say here, but don't know if you realise that the work around mentioned in this thread might actually not be applicable to everyone. I for one don't get the option to simply change the target framework without changing the target .net runtime which then breaks dependencies.

Ghostbird commented 1 year ago

I don't get why you would have to change the target framework. The workaround applies to the MediaPicker.CaptureAsync bug, and involves a downgrade of the Android SDK, from API 33 which is supported in .NET 7.0+ to SDK 32 which is supported in .NET 6.0+.

My thought are:

Please explain where I went wrong, and I might be able to help you find a working solution.

guillaumedotnet commented 1 year ago

Unfortunately, some individuals, including myself, are unable to revert from Android version 33 to version 32 due to the utilization of specific libraries that require the former and its accompanying new permissions, particularly ZXing.

I am wondering if there is a guarantee that we will be able to access these new permissions in a Service Release for .NET 7. Your message was edited, and you acknowledged some uncertainty regarding this matter.

Thank you for your assistance.

Ghostbird commented 1 year ago

Interesting, the app I'm building has no trouble with ZXing.Net.Maui and ZXing.Net.Maui.Controls, both version 0.3.0-preview.1 on Android API 32.

There are no new permissions in the service release AFAIK. In API 33 some permissions have been removed. The bug I'm referring is that the MediaPicker.CaptureAsync method required one of those permissions. This broke API 33 compatibility as Android will always return permission denied as that permission no longer exists.

The fix that should be in the next service release, skips that permission check in Android API 33+

HurseyNZ commented 1 year ago
  • If you're on .NET 7.0 you can safely downgrade to API 32 until the next service release.

This is my issue, I'm on .net7 but unable to select any target api other than 33, the options for other api levels simply are not there via the project properties.
image

I'm quite happy to admit I could be overlooking something, perhaps you'd be kind enough to put a guide together on how to do this?

sidewinder94 commented 1 year ago

@HurseyNZ You need to manually edit the android manifest file and edit the "android:targetSdkVersion" property to have a value <= 32.

You WILL have a warning in your build stating that you only have the SDK for API level 33. This is expected and should have no consequences

guillaumedotnet commented 1 year ago

Interesting, the app I'm building has no trouble with ZXing.Net.Maui and ZXing.Net.Maui.Controls, both version 0.3.0-preview.1 on Android API 32.

Can you explain me the procedure to follow knowing that the package explicitly targets Android 33?

Capture d’écran 2023-03-15 à 10 17 58
AHComp commented 1 year ago

Hey does anybody try to publish a app downgraded to api 32 ? I got an error on try to publish !

image

Ghostbird commented 1 year ago

@HurseyNZ I'm not familiar with the tooling you're using. I'm using plain dotnet to build. It may be that your IDE is preventing you from taking actions that are non-standard, even if completely valid. As @sidewinder94 says, you can change the setting in AndroidManifest.xml.

@AHComp The warnings about XA1006, XA4211 are valid, and do not block publishing. These warnings are shown because the situation is undesirable. It is however not problematic and in this case done with purpose as a temporary workaround. From what I'm seeing, some other warnings may be obscured because of a missing translation to German. Ich weiß das die Deutschen Deutsch lieben. However, in this case you may want to try to find a way to run in English, just to verify whether there's an error that cannot be shown in German.

Ghostbird commented 1 year ago

@guillaumelimoo Is that targeting actually causing problems? Because it doesn't cause me any problems. Note that as the error says, ACW compilation still uses API-33. I'm not sure what ACW compilation is, apparently to an extent it still uses API 33. In my case I avoid the issues caused by the permissions, yet ZXing still works properly. The relevant section of my AndroidManifest.xml was shown earlier in the thread. I had some issues myself getting the configuration right. In my case I had to ensure there was no android:maxSdkVersion="32" in <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />. I thought this was counter-intuitive, but I think it is because of that ACW compilation thing.

AHComp commented 1 year ago

Today we have .net 7.0.4 is this solved in this release ?

Am Mi., 15. März 2023 um 14:39 Uhr schrieb Gijsbert ter Horst < @.***>:

@guillaumelimoo https://github.com/guillaumelimoo Is that targeting actually causing problems? Because it doesn't cause me any problems. Note that as the error says, ACW compilation still uses API-33. I'm not sure what ACW compilation is, apparently to an extent it still uses API 33. In my case I avoid the issues caused by the permissions, yet ZXing still works properly. The relevant section of my AndroidManifest.xml was shown earlier in the thread. I had some issues myself getting the configuration right. In my case I had to ensure there was no maxSdkVersion in <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />. I thought this was counter-intuitive, but it I think it is because of that ACW compilation thing.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/maui/issues/11275#issuecomment-1470028781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISUTQG4KCWTA6X4CLY5HNLW4HBADANCNFSM6AAAAAAR5DB6KM . You are receiving this because you were mentioned.Message ID: @.***>

Ghostbird commented 1 year ago

No, this is a MAUI problem, not a .NET problem. We're waiting for the next .NET MAUI 7.0 service release.