title: Can't use Xam.Plugin.Media plugin
body: <p>I have android application that is built using Xamarin Forms. In order to use camera of the mobile, I install Xam.Plugin.Media plugin and follow exactly the instructions of <a href="https://www.youtube.com/watch?v=DJYLrVNY2ak" rel="nofollow noreferrer">this video</a>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public async void TakePhotoAsAttachment(object sender, EventArgs e)
          {
              await CrossMedia.Current.Initialize();
  
              if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
              {
                  await DisplayAlert("No Camera", ":( No camera available.", "OK");
                  return;
              }
  
              var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
              {
                  Directory = "Sample",
                  Name = "test.jpg"
              });
  
              if (file == null)
                  return;
  
              await DisplayAlert("File Location", file.Path, "OK");
  
              image.Source = ImageSource.FromStream(() =&gt;
              {
                  var stream = file.GetStream();
                  return stream;
              });
          }
  </code></pre>
  
  <p>However, when executing this code:</p>
  
  <pre><code>        var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
          {
              Directory = "Sample",
              Name = "test.jpg"
          });
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>{Java.Lang.ClassNotFoundException:
    md55b01af31820394fbfb172542d1258596.MediaPickerActivity --->
    Java.Lang.ClassNotFoundException: Didn't find class
    "md55b01af31820394fbfb172542d1258596.MediaPickerActivity" on path:
    DexPathList[[zip file
    "/data/app/com.companyname.EClinicForDoctor-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.EClinicForDoctor-1/lib/arm,
    /data/app/com.companyname.EClinicForDoctor-1/base.apk!/lib/armeabi-v7a,
    /vendor/lib, /system/lib]]    --- End of inner exception stack trace
    ---   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod
    (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo
    method, Java.Interop.JniArgumentValue* args) [0x00069] in
    &lt;54816278eed9488eb28d3597fecd78f8>:0    at
    Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass,
    System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in
    :0    at
    Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass,
    System.IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00017] in
    :0    at
    Android.Runtime.JNIEnv.FindClass (System.String classname) [0x0003d]
    in :0    at
    Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00084] in
    :0    at Java.Lang.Class.FromType
    (System.Type type) [0x00022] in :0<br>
    at Android.Content.Intent..ctor (Android.Content.Context
    packageContext, System.Type type) [0x00000] in
    :0    at
    Plugin.Media.MediaImplementation.CreateMediaIntent (System.Int32 id,
    System.String type, System.String action,
    Plugin.Media.Abstractions.StoreMediaOptions options, System.Boolean
    tasked) [0x00000] in
    C:\projects\mediaplugin\src\Media.Plugin.Android\MediaImplementation.cs:411
    at Plugin.Media.MediaImplementation.TakeMediaAsync (System.String
    type, System.String action,
    Plugin.Media.Abstractions.StoreMediaOptions options) [0x00044] in
    C:\projects\mediaplugin\src\Media.Plugin.Android\MediaImplementation.cs:470
    at Plugin.Media.MediaImplementation+d__17.MoveNext ()
    [0x000ab] in
    C:\projects\mediaplugin\src\Media.Plugin.Android\MediaImplementation.cs:153</p>
    
    <p>--- End of stack trace from previous location where exception was thrown ---   at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
    [0x0000c] in &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
    (System.Threading.Tasks.Task task) [0x0003e] in
    &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
    (System.Threading.Tasks.Task task) [0x00028] in
    &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
    (System.Threading.Tasks.Task task) [0x00008] in
    &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult ()
    [0x00000] in &lt;657aa8fea4454dc898a9e5f379c58734>:0    at
    EClinicForDoctor.Pages.VisitsPage+d__17.MoveNext
    () [0x00175] in E:\Doctor Project\Mobile
    Applications\v1\4\EClinicForDoctor\EClinicForDoctor\EClinicForDoctor\Pages\VisitsPage.xaml.cs:235
    --- End of managed Java.Lang.ClassNotFoundException stack trace --- java.lang.ClassNotFoundException:
    md55b01af31820394fbfb172542d1258596.MediaPickerActivity   at
    java.lang.Class.classForName(Native Method)   at
    java.lang.Class.forName(Class.java:324)   at
    md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.n_onClick(Native
    Method)   at
    md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
      at android.view.View.performClick(View.java:5697)   at
    android.widget.TextView.performClick(TextView.java:10826)     at
    android.view.View$PerformClick.run(View.java:22526)   at
    android.os.Handler.handleCallback(Handler.java:739)   at
    android.os.Handler.dispatchMessage(Handler.java:95)   at
    android.os.Looper.loop(Looper.java:158)   at
    android.app.ActivityThread.main(ActivityThread.java:7225)     at
    java.lang.reflect.Method.invoke(Native Method)    at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    Caused by: java.lang.ClassNotFoundException: Didn't find class
    "md55b01af31820394fbfb172542d1258596.MediaPickerActivity" on path:
    DexPathList[[zip file
    "/data/app/com.companyname.EClinicForDoctor-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.EClinicForDoctor-1/lib/arm,
    /data/app/com.companyname.EClinicForDoctor-1/base.apk!/lib/armeabi-v7a,
    /vendor/lib, /system/lib]]    at
    dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)    at
    java.lang.ClassLoader.loadClass(ClassLoader.java:469)     ... 14 more
      Suppressed: java.lang.ClassNotFoundException:
    md55b01af31820394fbfb172542d1258596.MediaPickerActivity       at
    java.lang.Class.classForName(Native Method)       at
    java.lang.BootClassLoader.findClass(ClassLoader.java:781)         at
    java.lang.BootClassLoader.loadClass(ClassLoader.java:841)         at
    java.lang.ClassLoader.loadClass(ClassLoader.java:504)         ... 15 more
      Caused by: java.lang.NoClassDefFoundError: Class not found using the
    boot class loader; no stack trace available }</p>
  </blockquote>
  
  <p>Then I read the instructions of the plugin from <a href="https://github.com/jamesmontemagno/MediaPlugin" rel="nofollow noreferrer">github</a> which it was somehow similar to the instructions of the video and the same error occur. How can solve this problem?</p>