Xamarin MediaPlugin和不同的Android版本 [英] Xamarin MediaPlugin and different Android version
问题描述
媒体插件有问题. 如果编译目标是Android 6.0,则在我的设备V.5.0.1中的调试模式下可以正常工作.问题是,当我在发布模式下编译时,会收到此错误:
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)
我已阅读如果我将编译版本更新为Android 7(API 24),就可以解决该问题,但是在此之后,我的操作按钮将无法正常工作.当我点击按钮打开相机时,我收到此错误:
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
我能做什么?谢谢!
推荐答案
我想我找到了一个解决方案: 我打开AndroidManifest.xml文件,并删除了android target版本属性.
I think I found a solution: I opened AndroidManifest.xml file and I removed the android target version property.
现在我只有:
Android编译版本:7.1 Android最低版本:4.1
Android compilation version: 7.1 Android miminal version: 4.1
这篇关于Xamarin MediaPlugin和不同的Android版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!