Un expected TargetSdkVersion

Using F-Droid to install the Wifi Camera app on different telephones, I get a message saying
“Error installing Wifi Camera TargetSdkVersion of apk file (9) is not the expected TargetSdkVersion (14)!”
One phone is a Samsung SM-G386w, Android version 4.4.2 and the other is SM-A105M, Android version 10
For what I understand (!) I should use Android Studio to change TargetSdkVersion and then recompile …
My questions are :
Can it work ?
Is it the way to do it ?
What are better or simpler alternatives ?
Thanks a lot !

It is possible to rebuild the application with newer target sdk, though it may require changes to the source code because some parts of code may be deprecated.