For ABP joins, make an ABP connection with modem.joinABP (dev_addr, NwkSKey, AppSKey).
However, after verifying the log on the gateway after ABP connection, the address of dev_addr is different from the value when input to JoinABP, and the uplink message transmission fails.
How can I use ABP to send an Uplink message without changing dev_addr?
If the transmission failure is on the node, with ABP in principle it has nothing to do with what is happening on the gateway, except for one detail that is not really documented: when you end the transmission with the following code, try to substitute true with false:
err = modem.endPacket(true);
True means "confirmed" packet, which is not always possible (in particular if you are using a single channel gateway). Change to false, and it should work.
Regarding the dev_addr issue, which gateway are you using? with a Rpi + Dragino, I had sometimes wrong addresses (similar but not identical) that I never understood if coming from transmission errors (unlikely) or sw issues. Do not put the node too close to the gateway, to avoid some issues.