powered by Jive Software

Problems with aSMACK file transfer

I’ve been trying to bring file transfer capabilities into my mobile client and have been running into major issues. I’ve pretty much followed the code example herehttp://harryjoy.com/2012/08/18/file-transfer-in-android-with-asmack-and-openfire /

For Sending a file, I’m getting this

E/AndroidRuntime( 3756): FATAL EXCEPTION: File Transfer jsi_20634193635998184

E/AndroidRuntime( 3756): java.lang.ClassCastException: org.jivesoftware.smack.ut

il.PacketParserUtils$UnparsedResultIQ cannot be cast to org.jivesoftware.smackx.

bytestreams.socks5.packet.Bytestream

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.bytestreams.socks5.So

cks5BytestreamManager.determineStreamHostInfos(Socks5BytestreamManager.java:611)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.bytestreams.socks5.So

cks5BytestreamManager.establishSession(Socks5BytestreamManager.java:445)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.filetransfer.Socks5Tr

ansferNegotiator.createOutgoingStream(Socks5TransferNegotiator.java:57)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.filetransfer.FaultTol

erantNegotiator.createOutgoingStream(FaultTolerantNegotiator.java:145)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.filetransfer.Outgoing

FileTransfer.negotiateStream(OutgoingFileTransfer.java:383)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.filetransfer.Outgoing

FileTransfer.access$100(OutgoingFileTransfer.java:35)

E/AndroidRuntime( 3756): at org.jivesoftware.smackx.filetransfer.Outgoing

FileTransfer$2.run(OutgoingFileTransfer.java:216)

E/AndroidRuntime( 3756): at java.lang.Thread.run(Thread.java:856)

and for recieving, I’m getting this

FATAL EXCEPTION: File Transfer jsi_904966237490336963

E/AndroidRuntime( 3377): java.lang.NullPointerException

E/AndroidRuntime( 3377): at org.jivesoftware.smackx.filetransfer.Incoming

FileTransfer.negotiateStream(IncomingFileTransfer.java:179)

E/AndroidRuntime( 3377): at org.jivesoftware.smackx.filetransfer.Incoming

FileTransfer$1.run(IncomingFileTransfer.java:124)

E/AndroidRuntime( 3377): at java.lang.Thread.run(Thread.java:856)

Any ideas or advice?

Which aSmack version are you using?

Besides I can only recommend reading https://github.com/Flowdalic/asmack/wiki/aSmack-XMPP-File-Transfer

I’m using verision .8, the same that comes in the latest version of Yaxim. I managed to get it to send a file by putting

SmackAndroid.init(mService); as the first line of my sendFile Method, however, I still get an error with recieving a file. transfer.recieveFile() and transfer.recieveFile(file) both do not work and cause a null point exception in my code.

Put some small amount of code for better understadning …