asmack的Andr​​oid,无法传输文件 [英] asmack android ,unable to transfer file

查看:224
本文介绍了asmack的Andr​​oid,无法传输文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能用了咂嘴传输文件,我使用Android模拟器,一边和火花另一方。当我做传输应用力以下错误消息和文件传输请求,通知关闭,接受文件后,出现了一个错误转化中的file.error日志粘贴下面。

我搜索不同的解决方案,其中一个说:

  

首先,你要一个smack.properties复制到你的Andr​​oid模拟器。   您可以在原来的SMACK API网站获得smack.properties。

     

http://www.igniterealtime.org/downloads/source.jsp

我打开了网站,并下载了咂嘴,但无法找到 smack.properties 到源代码code。 第一选择关闭。

建议

二的解决方案是修改 discoverLocalIP的实现() org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.discoverLocalIP()这我无法找到。

我如何可以传输文件?


  WARN / dalvikvm(4994):主题ID = 25:线程退出与未捕获的异常(组= 0x4001b188)
ERROR / AndroidRuntime(4994):未捕获的处理程序:线程文件传输jsi_8875615847496033183由于退出未捕获的异常
ERROR / AndroidRuntime(4994):java.lang.ClassCastException:org.jivesoftware.smack.util.PacketParserUtils $ 2
ERROR / AndroidRuntime(4994):在org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.negotiateOutgoingTransfer(FileTransferNegotiator.java:401)
ERROR / AndroidRuntime(4994):在org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(OutgoingFileTransfer.java:359)
ERROR / AndroidRuntime(4994):在org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access $ 100(OutgoingFileTransfer.java:35)
ERROR / AndroidRuntime(4994):在org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer $ 2.运行(OutgoingFileTransfer.java:214)
ERROR / AndroidRuntime(4994):在java.lang.Thread.run(Thread.java:1096)
 

解决方案

该配置文件是在

 资源/ META-INF /
 

在那些你需要的是

 嫌-config.xml中
smack.providers
 

您特定的错误是由以下事实引起的在的ProviderManager 尚未配置了 smack.providers 文件。这导致进入的数据包被读入默认的 PacketExtension ,而不是一台配置为特定节的类型。

如果您使用的是asmack,我认为这将是已经处理。如果经常啪,你将必须配置ProviderManager的读取正确的位置的文件。

我想你可以通过扩展做到这一点的的ProviderManager 并重写的初始化()的方法。基本上复制现有的一个,但指定了Android资源目录,而不是META-INF之一。已经有针对此一吉拉任务可以使目录配置的,但它没有解决尚未。

此外,还有被固定在最新的版本(3.2.1)的文件传输中的错误。

I am unable to transfer file using a smack, I am using android emulator on one side and spark on the other. When I do transfer the application force closes with the following error messages and a notification of file transfer request, after accepting the file, there was an error transfering the file.error log is pasted below.

I searched different solution and one of them says:

First, you have to copy a smack.properties to you android emulator. You can get smack.properties at the original SMACK API site.

http://www.igniterealtime.org/downloads/source.jsp

I opened the site and downloaded the source code of smack but unable to find smack.properties anywhere. 1st choice closed.

Second solution proposed was to change the implementation of discoverLocalIP() in org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.discoverLocalIP() which I am unable to find.

How can i transfer file?


WARN/dalvikvm(4994): threadid=25: thread exiting with uncaught exception (group=0x4001b188)
ERROR/AndroidRuntime(4994): Uncaught handler: thread File Transfer jsi_8875615847496033183 exiting due to uncaught exception
ERROR/AndroidRuntime(4994): java.lang.ClassCastException: org.jivesoftware.smack.util.PacketParserUtils$2
ERROR/AndroidRuntime(4994):     at org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.negotiateOutgoingTransfer(FileTransferNegotiator.java:401)
ERROR/AndroidRuntime(4994):     at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(OutgoingFileTransfer.java:359)
ERROR/AndroidRuntime(4994):     at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access$100(OutgoingFileTransfer.java:35)
ERROR/AndroidRuntime(4994):     at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer$2.run(OutgoingFileTransfer.java:214)
ERROR/AndroidRuntime(4994):     at java.lang.Thread.run(Thread.java:1096)

解决方案

The config files are under

resources/META-INF/

The ones you will need are

smack-config.xml
smack.providers

Your specific error is caused by the fact that the ProviderManager has not been configured with the smack.providers file. This results in the incoming packets being read into the default PacketExtension instead of the one configured for the specific stanza type.

If you are using asmack, I would think that would be handled already. If regular Smack, you will have to configure the ProviderManager to read the file from the right location.

I think you can do this by extending ProviderManager and overriding the initialize() method. Basically copy the existing one but specify the android resource directory instead of the META-INF one. There is already a Jira task against this to make the directory configurable, but it isn't resolved yet.

In addition, there was a bug in file transfer that was fixed in the latest version (3.2.1).

这篇关于asmack的Andr​​oid,无法传输文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆