I'm trying to make a signed transaction in Android metamask using wallet connect send the transaction to my backend-server and then submit it to blockchain.
However, it's hard to find how I can just sign transaction(not sending it) and send it to my backend server.
I can signed the message using personal_sign, but not getting how to sign a transaction.
Why do you want to submit the transaction to the backend without executing it? Wouldn't it just be easier to execute the transaction immediately?
Anyways, Metamask doesn't support the RPC for only signing transactions without submitting them. See https://github.com/MetaMask/metamask-extension/issues/3475
EDIT: to send a transaction and send it, just use the following code, modified from my answer at https://stackoverflow.com/a/71941911/11628256: