How to make transaction with many inputs and one output in BitcoinJ? I'm trying to send all coins from my accounts (generated by HD Wallet) to one account with this code:
fun sendAllFundsOnAddress(address: String) {
        val receiver = Address.fromString(params, address)
        val tx = Transaction(params)

        val balance = Coin.valueOf(walletAppKit.wallet().unspents.map { it.value.value }.sum())
        tx.addOutput(balance, receiver)

        walletAppKit.wallet().unspents.forEach {
            val key = walletAppKit.wallet().findKeyFromAddress(Address.fromString(params, it.scriptPubKey.getToAddress(params).toString()))
            tx.addSignedInput(it.outPointFor, it.scriptPubKey, key, Transaction.SigHash.ALL, true)
        }

        walletAppKit.wallet().commitTx(tx)
        val sendRequest = SendRequest.forTx(tx)
        walletAppKit.wallet().completeTx(sendRequest)
    }

But I get NullPointerException, while it calculates witness (in input signing process).
Could you give any ideas, what's wrong?
SendRequest sendRequest = SendRequest.emptyWallet(receiver);
Transaction tx = walletAppKit().wallet().sendCoinsOffline(sendRequest);
System.out.println(Hex.toHexString(tx.bitcoinSerialize()));

In your original code, you loop through each UTXO in your wallet and add it as a signed input, essentially emptying the wallet to the output specified.
The code above does the same but using a different method.
You should also be calling completeTx() before commitTx(), but sendCoinsOffline() takes care of that for you.
The raw transaction hex is then printed out in my code, which you can then send to a node to broadcast. If you want bitcoinj's WalletAppKit to do that for you as well, look into Wallet.sendCoins().
The transaction generated with your code would be invalid either way, as you aren't subtracting enough (or anything, in your case) for transaction fees.