gpt4 book ai didi

android - Xamarin.Android 不支持在我的本地 andorid 设备上部署解决方案时运行以前的版本

转载 作者:行者123 更新时间:2023-11-30 00:00:55 26 4
gpt4 key购买 nike

我的 Xamarin PCL 项目运行良好,因为我下载了 Android SDK Platform 27 并更新了所有 NuGet 包。

当尝试将解决方案部署到我的设备(运行 Android 7.1)时,我收到此输出错误:

Build Failed: Xamarin.Android does not support running the previous version. Please ensure your solution builds before running or debugging it.

调试本项目时生成日志:

2>Starting deploy Xiaomi Redmi 4A ...
2>Deploying Xiaomi Redmi 4A ...
2>Build started.
2>Project "MobileApp.Android.csproj" (Install target(s)):
2>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.2\zipalign.exe 4 "C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\MobileApp\MobileApp.Android\obj\Debug\android\bin\com.admir.instantcollect.apk" "bin\Debug\\com.admir.instantcollect-Signed.apk"
2>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.2\zipalign.exe 4 "C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\MobileApp\MobileApp.Android\obj\Debug\android\bin\com.admir.instantcollect-arm64-v8a.apk" "bin\Debug\\com.admir.instantcollect-arm64-v8a-Signed.apk"
2>"zipalign.exe" exited with code 1.
2>Done building project "MobileApp.Android.csproj" -- FAILED.
2>Build FAILED.
2>Build started.
2>Project "MobileApp.Android.csproj" (Install target(s)):
2>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.2\zipalign.exe 4 "C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\MobileApp\MobileApp.Android\obj\Debug\android\bin\com.admir.instantcollect.apk" "bin\Debug\\com.admir.instantcollect-Signed.apk"
2>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.2\zipalign.exe 4 "C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\MobileApp\MobileApp.Android\obj\Debug\android\bin\com.admir.instantcollect-arm64-v8a.apk" "bin\Debug\\com.admir.instantcollect-arm64-v8a-Signed.apk"
2>"zipalign.exe" exited with code 1.
2>Done building project "MobileApp.Android.csproj" -- FAILED.
2>Build FAILED.
2>
2>Deploy failed on Xiaomi Redmi 4A
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

我尝试构建/清理-重建解决方案并且构建成功。这是构建输出日志:

 1>------ Build started: Project: MobileApp.Android, Configuration: Debug Any CPU ------
1> No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> Consider app.config remapping of assembly "System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [] to Version "4.1.0.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
1> MobileApp.Android -> C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\MobileApp\MobileApp.Android\bin\Debug\mobileapp.android.dll
1> No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> No way to resolve conflict between "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" and "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" arbitrarily.
1> No way to resolve conflict between "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" and "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" arbitrarily.
1> No way to resolve conflict between "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" and "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" arbitrarily.
1> No way to resolve conflict between "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1> Consider app.config remapping of assembly "mscorlib, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.5.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.5.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Xml, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.5.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Core, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "3.5.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Runtime.Serialization, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "3.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "6.0.0.0" [C:\Program Files\IIS\Microsoft Web Deploy V3\Newtonsoft.Json.dll] to Version "11.0.0.0" [C:\Users\DAFPC\documents\visual studio 2017\Projects\MobileApp\packages\Newtonsoft.Json.11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "System.Xml.Linq, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "3.5.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll] to Version "4.0.0.0" [] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2245,3): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="mscorlib" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Core" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Serialization" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.Linq" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
  • 我已将 Target 框架设置为 Android 8.1 最新平台。
  • 目标 Android 版本:使用 SDK 版本编译
  • 最低 Android 版本:Android 4.4

这是我已经安装的 Android SDK 的列表: enter image description here

我曾尝试将目标平台更改为 7.1,但情况变得更糟

我在使用任何 AVD 模拟器时都遇到同样的错误。

谁能解释一下为什么会出现这个错误,我该怎么做才能解决它。

最佳答案

当我过去遇到这个问题时,问题是我正在部署到一个已经安装了应用程序版本的设备上,有两种可能性:

  1. 已安装版本的版本代码大于我尝试部署的版本代码,和/或
  2. 安装的版本是我的应用程序的 Play Store 版本,无法被 Xamarin.Android 工具覆盖。

您可能还会在错误列表中看到错误:

ADB0030: Mono.AndroidTools.RequiresUninstallException: The installed package is incompatible. Please manually uninstall and try again.

在我的案例中,解决方案是以下一种或两种:

  1. 通过 UI 或在命令提示符下使用 ADB(例如 adb uninstall packagename)从我的设备上卸载该应用程序,然后再次尝试我的部署。

    <
  2. 更改程序包 list (Project.Android>Properties>Android Manifest)使其具有比当前安装版本更高的版本代码,然后再次尝试我的部署。

关于android - Xamarin.Android 不支持在我的本地 andorid 设备上部署解决方案时运行以前的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49943792/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com