我一遍又一遍地遇到问题。如果我在Xamarin Studio中创建一个项目,构建并运行它,一切正常。
然后我在VS2015中打开同一个项目,我可以构建它并且没有错误显示。但是,如果我尝试将其运行(或部署)到设备或模拟器,则会失败。
这是Visual Studio 2015在“输出”窗口中显示的信息
1>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2046-09-30) or after any future revocation date.
1>C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.0\zipalign.exe 4 "C:\Users\me\Desktop\work\xamarin\LocationTrackingService\LocationTrackingService\bin\Debug\com.user.learning.locationtrackingservice-Signed-Unaligned.apk" "bin\Debug\\com.user.learning.locationtrackingservice-Signed.apk"
1>C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s ENU7N16723000122 devices
1>C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s ENU7N16723000122 shell getprop ro.build.version.sdk
1>C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s ENU7N16723000122 shell getprop ro.product.cpu.abilist64
1>C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s ENU7N16723000122 shell pm dump com.user.learning.locationtrackingservice
1>The "InstallPackageAssemblies" task failed unexpectedly.
1>System.AggregateException: One or more errors occurred. ---> Xamarin.AndroidTools.AndroidDeploymentException: InternalError ---> Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.usere.learning.locationtrackingservice signatures do not match the previously installed version; ignoring!]
1> at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
1> at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass91_0.<InstallPackage>b__0(Task`1 t)
1> at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
1> at System.Threading.Tasks.Task.Execute()
1> --- End of inner exception stack trace ---
1> at Xamarin.AndroidTools.AndroidDeploySession.<RunLoggedAsync>d__99.MoveNext()
1>--- End of stack trace from previous location where exception was thrown ---
1> at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1> at Xamarin.AndroidTools.AndroidDeploySession.<StartAsync>d__98.MoveNext()
1> --- End of inner exception stack trace ---
1> at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
1> at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
1> at System.Threading.Tasks.Task.Wait()
1> at Xamarin.Android.Tasks.InstallPackageAssemblies.Execute()
1> at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1> at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>---> (Inner Exception #0) Xamarin.AndroidTools.AndroidDeploymentException: InternalError ---> Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.user.learning.locationtrackingservice signatures do not match the previously installed version; ignoring!]
1> at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
1> at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass91_0.<InstallPackage>b__0(Task`1 t)
1> at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
1> at System.Threading.Tasks.Task.Execute()
1> --- End of inner exception stack trace ---
1> at Xamarin.AndroidTools.AndroidDeploySession.<RunLoggedAsync>d__99.MoveNext()
1>--- End of stack trace from previous location where exception was thrown ---
1> at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1> at Xamarin.AndroidTools.AndroidDeploySession.<StartAsync>d__98.MoveNext()<---
1>
1>Build FAILED.
1>
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
我不知道为什么会发生这种情况以及如何解决这个问题。我的理解是,在Xamarin Studio中创建的项目可以在Visual Studio中打开和运行,反之亦然。
答案 0 :(得分:0)
我想我发现了问题所在。运行adb设备列出了我的设备和模拟器的数量,我没有运行......奇怪。
颁发
adb kill-server
adb start-server
adb devices
删除了所有模拟器,现在只有我的设备列为正在运行
接下来,我发了
adb uninstall "com.usere.learning.locationtrackingservice"
这确保我的应用程序的先前版本肯定已卸载,并且没有以某种方式在设备上留下一些未安装的文件。
在此之后,我能够部署并运行。
答案 1 :(得分:0)
还有另一种解决方案对我有用,步骤如下:
它应该解决这个问题。