Xamarin MediaPlugin and different Android version

蹲街弑〆低调 提交于 2019-12-24 18:18:27

问题


I have a problem with Media Plugin. If the compilation target is Android 6.0 it works fine in debug mode in my device that is V. 5.0.1. The problem is that when I compile in Release mode I receive this error:

> Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Android.Views.KeyboardShortcutGroup' (defined in assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Views.KeyboardShortcutGroup
   in Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   in MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   in Mono.Linker.Steps.MarkStep.MarkGenericArguments(IGenericInstance instance)
   in Mono.Linker.Steps.MarkStep.GetOriginalType(TypeReference type)
   in Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   in MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   in Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   in Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   in Mono.Linker.Steps.MarkStep.ProcessQueue()
   in Mono.Linker.Steps.MarkStep.Process()
   in Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   in MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   in Mono.Linker.Pipeline.Process(LinkContext context)
   in MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   in Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)

I read that the problem is solved if I will update the compile version to Android 7 (API 24), but after this my action button doesn't work fine. When I tap the button to open the camera I receive this error:

Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference

What I can do? Thanks!


回答1:


I think I found a solution: I opened AndroidManifest.xml file and I removed the android target version property.

Now I have only:

Android compilation version: 7.1 Android miminal version: 4.1



来源:https://stackoverflow.com/questions/45417829/xamarin-mediaplugin-and-different-android-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!