Forum Cross Platform with Xamarin

jamesmontemagno/MediaPlugin and FreshMVVM

1 week into Visual Studio 2015 Community, Xamarin & FreshMVVM. Great environment.

I am trying to implement Cross Platform PCL Android and IOS camera app.

1) Downloaded "MedialSample" solution example successfully runs on Android phone.

2) I modified Mark Ridland's app:

Nuget'ed MediaPlugin package to PCL project
Added Button and Image in Xaml

The Button "FreshMVVM Command" syntax, calls MediaPlugin.

Error message: "This functionality is not implemented in the portable version of this assembly.
You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."

Please advise and send detailed code (new to XaMarin), Android Phone. Thanks.


<Button Text="Photo" Command="{Binding PhotoCommand}"></Button>
<Image x:Name="myimage"/>

    public Command PhotoCommand
            return new Command( async () =>
                string eMsg;

                    //***** ERROR. Any call to "CrossMedia package"  **************/
                    await CrossMedia.Current.Initialize();
                catch (Exception ex)
                    /* ERROR                         
                     * This functionality is not implemented in the portable version of this assembly.  
                     * You should reference the NuGet package from your main application project in order to reference 
         * the platform-specific implementation.                         
                    eMsg = ex.Message;

       //***** ERROR. Any call to "CrossMedia package"  **************/
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                    //DisplayAlert("No Camera", ":( No camera available.", "OK");

       //***** ERROR. Any call to "CrossMedia package"  **************/
                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                    Directory = "Sample",
                    Name = "test.jpg"

                if (file == null)

                //await DisplayAlert("File Location", file.Path, "OK");

                var page = FreshPageModelResolver.ResolvePageModel<ContactListPageModel>();
                global::Xamarin.Forms.Image image;
                image = page.FindByName<Image>("myimage");

                image.Source = ImageSource.FromStream(() =>
                    var stream = file.GetStream();
                    return stream;
            });    // return Command async
        } // get
    }  // PhotoCommand



  • MichaelRidlandMichaelRidland AUInsider, University ✭✭✭

    You need to make sure you have the MediaPlugin nuget in all projects.

  • NathanLawNathanLaw USMember

    Hi Michael,

    I included Media in the Droid project but am still getting the same error.

    Using Visual Studio Community 2015

    1) Droid Project Nuget Pkg

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

    2) PCL Nuget

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

    What should I try?


  • NathanLawNathanLaw USMember

    1) Droid Nuget
    ?xml version="1.0" encoding="utf-8"?
    package id="Fody" version="1.29.2" targetFramework="monoandroid70" developmentDependency="true" /
    package id="FreshMvvm" version="2.2.0" targetFramework="monoandroid60" /
    package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid70" /
    package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid70" /
    package id="PropertyChanged.Fody" version="1.52.1" targetFramework="monoandroid70" developmentDependency="true" /
    package id="Xam.Plugin.Media" version="2.3.0" targetFramework="monoandroid70" /
    package id="Xamarin.Android.Support.Design" version="" targetFramework="monoandroid60" /
    package id="Xamarin.Android.Support.v4" version="" targetFramework="monoandroid60" /
    package id="Xamarin.Android.Support.v7.AppCompat" version="" targetFramework="monoandroid60" /
    package id="Xamarin.Android.Support.v7.CardView" version="" targetFramework="monoandroid60" /
    package id="Xamarin.Android.Support.v7.MediaRouter" version="" targetFramework="monoandroid60" /
    package id="Xamarin.Forms" version="" targetFramework="monoandroid60" /

    2) PCL Nuget
    ?xml version="1.0" encoding="utf-8"?
    package id="Fody" version="1.29.2" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" /
    package id="FreshMvvm" version="2.2.0" targetFramework="portable45-net45+win8+wpa81" /
    package id="PropertyChanged.Fody" version="1.52.1" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" /
    package id="Xam.Plugin.Media" version="2.3.0" targetFramework="portable45-net45+win8+wpa81" /
    package id="Xamarin.Forms" version="" targetFramework="portable45-net45+win8+wpa81" /

  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Perhaps the package didn't get installed correctly try uninstalling it and re-installing it. This means your Android App is not referencing the correct DLLS.

  • NathanLawNathanLaw USMember

    Success. I deleted and reinstalled FreshMVVM, Fody and Media Plugin. Cleaned the solution.

    Thanks to Michael and James for great functionality and help !!

  • SamirgcSamirgc USMember ✭✭

    Xamarin.Android.Support.v7.AppCompat Error Solved It : Please follow the Link :smile:

    Hope This Helps

Sign In or Register to comment.