Building a single f-droid app in Ubuntu (22.04 or 24.04)

Hi,
Thank you to all f-froiders for a great job!
I got a simple question, but got lost in tons of partly outdated documentations, forums and tips. Probably, a just link to a working doc would do.

I want a slightly tweaked f-droid app for my phone (e.g. Rotation Lock + Landscape | F-Droid - Free and Open Source Android App Repository with only two states). My programming skills should be sufficient to get the needed code with few trials/failures.

I have a computer with Ubuntu 22.04. What would be a simplest way to get .apk out of the source? I seek for a minimalist solution without installing android studio, signing the .apk etc. Just basic commands preferably with only the stuff available from apt.