Building Asmack

Hello,

I want to edit and add custom attribute in the asmack message XML tag.

So I think at first I have to build the source first and then edit the source and build it again.
But when building at the first time there is error

BUILD FAILED

/home/niko/Downloads/asmack-master/build.xml:65: Compile failed; see the compiler error output for details.

and this is the stacktrace

Building for android-8

Buildfile: /home/niko/Downloads/asmack-master/build.xml

check-android-exists:

compile-android:

[mkdir] Created dir: /home/niko/Downloads/asmack-master/build/classes/android-8

[javac] Compiling 421 source files to /home/niko/Downloads/asmack-master/build/classes/android-8

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:577: expected

[javac] catch (NoResponseException|XMPPErrorException e) {

[javac] ^

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:577: ‘{’ expected

[javac] catch (NoResponseException|XMPPErrorException e) {

[javac] ^

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:577: not a statement

[javac] catch (NoResponseException|XMPPErrorException e) {

[javac] ^

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:577: ‘;’ expected

[javac] catch (NoResponseException|XMPPErrorException e) {

[javac] ^

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:616: illegal start of expression

[javac] private List determineStreamHostInfos(List proxies) {

[javac] ^

[javac] /home/niko/Downloads/asmack-master/build/src/org/jivesoftware/smackx/bytestream s/socks5/Socks5BytestreamManager.java:616: ‘;’ expected

[javac] private List determineStreamHostInfos(List proxies) {

[javac]

Is there anything I missed?
I’m sure that the android path is correct andI didn’t edit anything else beside local.properties file and change the javac to 6 in the build.bash (it return me error when set to 7)

is there anybody have idea where I go wrong?

Thank you!

I want to edit and add custom attribute in the asmack message XML tag.
Don’t do that, it will likely produce invalid XMPP XML. The XMPP way to add custom data to message stanzas is to add a custom PacketExtension. This is already supported by Smack, you don’t have to modify the source code.

1 Like

Ah so forexample I want to send and xml formatted like this

Hello somewone

I guess the first body with rid and sid already handled by the Smack and then the attribute to,type and xmlns already provided by Smack to.So if I want to add talk_id I need to create a new class that implement PacketExtension? and then how can I add it to the message class?

Thank you!

Message.addPacketExtension(PacketExtension)

1 Like

Thank you flow!