2016-11-14 73 views
0

我一直有一個問題一遍又一遍。如果我在Xamarin Studio中創建一個項目,構建它並運行它,則一切正常。Xamarin Android項目內置Xamarin Studio內置VS2015但部署失敗

然後我打開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

我想我找到了問題所在。運行adb設備列出了我的設備和仿真器的數量,其中沒有一個我正在運行......奇怪。

發行

adb kill-server 
adb start-server 
adb devices 

刪除了所有的模擬器,現在只有我的設備被列爲運行

接下來,我發出

adb uninstall "com.usere.learning.locationtrackingservice" 

這確信,我的應用程序的一個版本是肯定會被卸載,並且不會在設備上留下一些卸載的文件。

之後,我能夠部署和運行。