Xamarin:无法启动应用程序

时间:2017-08-10 10:22:56

标签: c# android visual-studio-2015 xamarin.android

我无法从Visual Studio 2015 / Xamarin将hello world应用程序部署到我的Android设备(Oneplus 3)。

我在MainActivity中检查了装饰器,MainLauncher设置为true。 我检查了Build-> Configuration Manager中的Deploy选项,并勾选了它。 我尝试从手机上的应用程序管理器中卸载应用程序,但它没有列出。

我尝试使用adb卸载应用程序但是它返回了此错误:

java.lang.IllegalArgumentException: Unknown package: com.test.helloandroid
    at com.android.server.pm.Settings.isOrphaned(Settings.java:4134)
    at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:18757)
    at...

所以看起来这个包甚至没有部署在手机上

包名称以小写字母开头,没问题。

我查看了构建日志,并看到以下消息之一:

1>:Deployment failed
1>Mono.AndroidTools.AdbException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
1>   in System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
1>   in System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
1>   --- End of inner exception stack trace ---
1>   in System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
1>   in Mono.AndroidTools.Util.ReadFullAsyncResult.BeginRead(Int32 offset, Int32 count, AsyncCallback callback)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.BeginReadFailMessage(ReadFullAsyncResult res)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_OnReadStatus(IAsyncResult ar)
1>   --- End of inner exception stack trace ---
1>   in Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.EndPush(IAsyncResult result)
1>   in System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
1>Deployment failed because of an internal error: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
1>InternalError
1>Build completed.
1>Deploy successfully on OnePlus A3003
========== Deployment: 1 completed, 0 not completed, 0 ignored ==========
Object reference not set to an object instance.
Object reference not set to an object instance.
Object reference not set to an object instance.

1>:Deployment failed
1>Mono.AndroidTools.AdbException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
1>   in System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
1>   in System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
1>   --- End of inner exception stack trace ---
1>   in System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_WriteChunk(WriteFileAsyncResult r)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_OnWroteChunk(IAsyncResult result)
1>   --- End of inner exception stack trace ---
1>   in Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token)
1>   in Mono.AndroidTools.Adb.AdbSyncClient.EndPush(IAsyncResult result)
1>   in System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
1>Deployment failed because of an internal error: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
1>InternalError
1>Build completed.
1>Deploy successfully on OnePlus A3003
========== Deployment: 1 completed, 0 not completed, 0 ignored ==========
Object reference not set to an object instance.
Object reference not set to an object instance.
Object reference not set to an object instance.

(对不起,如果在例外情况下有一些无意义,我翻译了它)

似乎Visual Studio或ADB 在手机上部署应用程序时遇到一些麻烦,原因是什么?我尝试更换USB端口,但我也没有运气。

我尝试创建一个新的Blank Xamarin.Android解决方案和Native Portable解决方案并部署它们,但它对我没有用。

我不知道此时该怎么做。我应该重置工厂吗?

0 个答案:

没有答案