dimonovdd / Xamarin.MediaGallery

This plugin is designed to picking and save images and video files from native gallery of Android and iOS devices and capture photos
MIT License
148 stars 18 forks source link

.NET 6, Maui and VS 17.3.2 #103

Closed simoncruise closed 1 year ago

simoncruise commented 2 years ago

Description

Won't work with .NET 6 and latest VS Maui release

Actual Behavior

When trying to run on the Android emulator, I get this error

Error java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: *****nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.9\buildTransitive\net6.0-android31.0....\jar\guava-listenablefuture.jar : com/google/common/util/concurrent/ListenableFuture.class SeeingAI.Android C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.415\tools\Xamarin.Android.D8.targets 79

Which I was able to fix by following this thread https://github.com/xamarin/AndroidX/issues/595

But, when I run MediaGallery.PickAsync, I get the following exception

Could not resolve type with token 0100005c from typeref (expected class 'Microsoft.Maui.Essentials.Platform' in assembly 'Microsoft.Maui.Essentials, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')

Configuration

cdavidyoung commented 1 year ago

If you clone this repo and build the sample Maui app you will find that it works as described. By following the instructions in the README.md and studying the sample code I was able to integrate it into my Maui app. It works for Android and iOS.

simoncruise commented 1 year ago

@dimonovdd thanks for the fix! Appreciate it!