Xamarin Android部署错误

Xamarin Android部署错误,android,visual-studio,xamarin,android-emulator,visual-studio-2017,Android,Visual Studio,Xamarin,Android Emulator,Visual Studio 2017,我有一个在我的Android 7.0物理设备上运行良好的应用程序,也可以与在Android 6.0 API 23上运行的模拟器配合使用。我想测试我的应用程序是否能在安卓5.1API22(Nexus4)上运行。但事实并非如此,它给出了一个错误: Android清单如下所示: Android选项页面如下所示: Android选项页面的高级选项如下所示: 应用程序选项: **注意:我尝试过使用advanced选项卡中的Supported Architecture(受支持的体系结构)菜单,并尝试

我有一个在我的Android 7.0物理设备上运行良好的应用程序,也可以与在Android 6.0 API 23上运行的模拟器配合使用。我想测试我的应用程序是否能在安卓5.1API22(Nexus4)上运行。但事实并非如此,它给出了一个错误:

Android清单如下所示:

Android选项页面如下所示:

Android选项页面的高级选项如下所示:

应用程序选项:

**注意:我尝试过使用advanced选项卡中的Supported Architecture(受支持的体系结构)菜单,并尝试过只选择“x86_64”,但这并没有为我解决错误

我从Xamarin Diagnostics的输出中得到:

[I:]:                     Found Xamarin.Android 7.3.1.2
[I:sdk]:                  Runtime path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community New\MSBuild\Xamarin\Android
[I:sdk]:                  Framework path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community New\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0
[I:sdk]:                    Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[I:sdk]:                    Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b).
[I:sdk]:                    Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files\Java\jdk1.8.0_131).
[I:]:                     Found Android SDK. API levels: 22, 23, 24, 25
[I:]:                     Tracking android devices started
[D:]:                     TrackDeviceTask got: 710f5e7a device
[I:]:                     Got new device list from adb with 1 devices
[D:RunShellCommand]:      710f5e7a getprop
[D:RunShellCommand]:      710f5e7a getprop
[D:]:                     Tracking avd started
[D:]:                     avd watcher *.ini path: 'C:\Users\cx67\.android\avd'
[D:]:                     avd watcher: got device list from avd with 5 devices
[D:]:                     avd watcher: got device list from avd with 5 devices
[D:]:                     TrackDeviceTask got: emulator-5554    offline, 710f5e7a   device
[I:]:                     Got new device list from adb with 2 devices
[D:]:                     TrackDeviceTask got: emulator-5554    device, 710f5e7a    device
[I:]:                     Got new device list from adb with 2 devices
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 date +%s
[D:RunShellCommand]:      emulator-5554 setprop "debug.mono.extra" "debug=127.0.0.1:29274:29275,timeout=1499696237,loglevel=0,server=y"
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 "echo" "-n" "${EMULATED_STORAGE_SOURCE}"
[D:RunShellCommand]:      emulator-5554 "echo" "-n" "${EMULATED_STORAGE_TARGET}"
[D:RunShellCommand]:      emulator-5554 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory"
[D:RunShellCommand]:      emulator-5554 "echo" "-n" "${EXTERNAL_STORAGE}"
[D:RunShellCommand]:      emulator-5554 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "LoginSystem.Android/md50ef850b548eeb6d8287c9a52e2084363.SplashActivity"
[D:RunShellCommand]:      emulator-5554 ps
[D:GetLogCat]:            logcat -v time
[D:RunShellCommand]:      emulator-5554 logcat -v time
[D:RunShellCommand]:      emulator-5554 am force-stop LoginSystem.Android
[D:RunShellCommand]:      emulator-5554 setprop "debug.mono.connect" ""
[D:]:                     avd watcher: got device list from avd with 5 devices
[D:]:                     TrackDeviceTask got: 710f5e7a device
[I:]:                     Got new device list from adb with 1 devices
[D:]:                     avd watcher: got device list from avd with 5 devices
[D:]:                     avd watcher: got device list from avd with 5 devices
[D:]:                     TrackDeviceTask got: emulator-5554    offline, 710f5e7a   device
[I:]:                     Got new device list from adb with 2 devices
[D:]:                     TrackDeviceTask got: emulator-5554    device, 710f5e7a    device
[I:]:                     Got new device list from adb with 2 devices
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      710f5e7a date +%s
[D:RunShellCommand]:      710f5e7a setprop "debug.mono.extra" "debug=127.0.0.1:29276:29277,timeout=1499697764,loglevel=0,server=y"
[D:RunShellCommand]:      710f5e7a getprop
[D:RunShellCommand]:      710f5e7a "echo" "-n" "${EMULATED_STORAGE_SOURCE}"
[D:RunShellCommand]:      710f5e7a "echo" "-n" "${EMULATED_STORAGE_TARGET}"
[D:RunShellCommand]:      710f5e7a am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory"
[D:RunShellCommand]:      710f5e7a am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "LoginSystem.Android/md50ef850b548eeb6d8287c9a52e2084363.SplashActivity"
[D:RunShellCommand]:      710f5e7a ps
[D:GetLogCat]:            logcat -v time
[D:RunShellCommand]:      710f5e7a logcat -v time
[D:RunShellCommand]:      710f5e7a am force-stop LoginSystem.Android
[D:RunShellCommand]:      710f5e7a setprop "debug.mono.connect" ""
[I:]:                     Found Android SDK. API levels: 22, 23, 24, 25
[D:RunShellCommand]:      emulator-5554 getprop
[D:RunShellCommand]:      emulator-5554 am broadcast -a "mono.android.intent.action.PACKAGE_VERSIONS" -e "packages" "Mono.Android.DebugRuntime,Mono.Android.Platform.ApiLevel_22,LoginSystem.Android" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.PackageVersions"
[D:RunShellCommand]:      emulator-5554 pm install "/data/local/tmp/LoginSystem.Android-Signed.apk"
[D:RunShellCommand]:      emulator-5554 rm "/data/local/tmp/LoginSystem.Android-Signed.apk"
[E:]:                     Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output:    pkg: /data/local/tmp/LoginSystem.Android-Signed.apk
Failure [0]

   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in C:\d\lanes\4699\fec6f88f\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\external\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 325
   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass91_0.<InstallPackage>b__0(Task`1 t) in C:\d\lanes\4699\fec6f88f\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\external\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 740
   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
[I:]:找到了Xamarin.Android 7.3.1.2
[I:sdk]:运行时路径:C:\Program Files(x86)\Microsoft Visual Studio\2017\Community New\MSBuild\Xamarin\Android
[I:sdk]:框架路径:C:\Program Files(x86)\Microsoft Visual Studio\2017\Community New\Common7\IDE\ReferenceAssembly\Microsoft\Framework\MonoAndroid\v1.0
[I:sdk]:键HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\AndroidSDK找到目录:
路径包含\平台工具(C:\Program Files(x86)\Android\Android sdk)中的adb。
[I:sdk]:密钥HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\AndroidNdkDirectory已找到:
路径包含\中的ndk堆栈。(C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b)。
[I:sdk]:找到HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_f80dbffe\Android\JavaSdkDirectory键:
路径包含\bin(C:\Program Files\Java\jdk1.8.0131)中的jarsigner.exe。
[I:]:找到了Android SDK。空气污染指数:22、23、24、25
[I:]:开始跟踪android设备
[D:]:跟踪设备任务:710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含1台设备
[D:RunShellCommand]:710f5e7a getprop
[D:RunShellCommand]:710f5e7a getprop
[D:]:已开始跟踪avd
[D:]:avd watcher*.ini路径:“C:\Users\cx67\.android\avd”
[D:]:avd观察者:已从avd获取设备列表,其中包含5台设备
[D:]:avd观察者:已从avd获取设备列表,其中包含5台设备
[D:]:TrackDeviceTask:emulator-5554离线,710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含2台设备
[D:]:TrackDeviceTask-got:emulator-5554设备,710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含2台设备
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554日期+%s
[D:RunShellCommand]:emulator-5554 setprop“debug.mono.extra”debug=127.0.0.1:29274:29275,超时=1499696237,日志级别=0,服务器=y
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554“echo”“-n”“${模拟存储\源代码}”
[D:RunShellCommand]:emulator-5554“echo”“-n”“${模拟存储\目标}”
[D:RunShellCommand]:emulator-5554 am广播-一个“mono.android.intent.action.EXTERNAL_STORAGE_目录”-n“mono.android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory”
[D:RunShellCommand]:emulator-5554“echo”“-n”“${EXTERNAL_STORAGE}”
[D:RunShellCommand]:emulator-5554 am start-a“android.intent.action.MAIN”-c“android.intent.category.LAUNCHER”-n“LoginSystem.android/md50ef850b548eeb6d8287c9a52e2084363.SplashActivity”
[D:RunShellCommand]:emulator-5554 ps
[D:GetLogCat]:logcat-v时间
[D:RunShellCommand]:emulator-5554 logcat-v时间
[D:RunShellCommand]:emulator-5554 am强制停止登录系统。Android
[D:RunShellCommand]:emulator-5554 setprop“debug.mono.connect”
[D:]:avd观察者:已从avd获取设备列表,其中包含5台设备
[D:]:跟踪设备任务:710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含1台设备
[D:]:avd观察者:已从avd获取设备列表,其中包含5台设备
[D:]:avd观察者:已从avd获取设备列表,其中包含5台设备
[D:]:TrackDeviceTask:emulator-5554离线,710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含2台设备
[D:]:TrackDeviceTask-got:emulator-5554设备,710f5e7a设备
[I:]:从adb获得了新设备列表,其中包含2台设备
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:emulator-5554 getprop
[D:RunShellCommand]:710f5e7a日期+%s
[D:RunShellCommand]:710f5e7a setprop“debug.mono.extra”debug=127.0.0.1:29276:29277,超时=1499697764,日志级别=0,服务器=y
[D:RunShellCommand]:710f5e7a getprop
[D:RunShellCommand]:710f5e7a“echo”“-n”“${模拟存储\源}”
[D:RunShellCommand]:710f5e7a“echo”“-n”“${模拟存储\目标}”
[D:RunShellCommand]:710f5e7a am广播-一个“mono.android.intent.action.EXTERNAL_STORAGE_目录”-n“mono.android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory”
[D:RunShellCommand]:710f5e7a am启动-a“android.intent.action.MAIN”-c“android.intent.category.LAUNCHER”-n“LoginSystem.android/md50ef850b548eeb6d8287c9a52e2084363.SplashActivity”
[D:RunShellCommand]:710f5e7a ps
[D:GetLogCat]:logcat-v时间
[D:RunShellCommand]:710f5e7a logcat-v时间
[D:RunShellCommand]:710f5e7a am强制停止登录系统。Android
[D:RunShellCommand]:710f5e7a setprop“debug.mono.connect”
我找到了安卓
Severity    Code    Description Project File    Line    Suppression State
Error       The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Android.App.Activity::OnRequestPermissionsResult(System.Int32,System.String[],Android.Content.PM.Permission[])' (defined in assembly 'Xamarin.Android.Support.Fragment, 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 System.Void Android.App.Activity::OnRequestPermissionsResult(System.Int32,System.String[],Android.Content.PM.Permission[])
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() LoginSystem.Android