In copyright law, such an app is a joint work, and each developer is a co-author. Either may use or license the work, but any profits are jointly owned, and in the absence of any specific agreement to the contrary, must be split equally.
If one co-author is marketing the work, and sharing the proceeds equally with the othe co-author, s/he is acting legally and there are no legal grounds for complaint,
A may not lawfully claim the entire work or all the profits, unless B agrees to give or sell the rights to A. Such a deal would need to be in writing under US law.
Either A or B could sell his or her rights (or some part of them) to a third party, or leave them by will or inheritance. Thew rights will last until 70 years after the death of whichever author is last to die in the US and many other countries, from 50 to 100 years after in various others. (It is unlikely that an app would still have monetary value nearly that long.)
Nonetheless it would be wise to draft and sign a written agreement, particularly if there is any chance of the app becoming popular enough to create substantial profits.
There is no need to form a company (although there can be advantages to doing that). But a clear agreement on ownership shares (particularly if they are to be anything other than equal), rights, and division of profits, could avoid later trouble. If the consent of both co-authors for granting a license is to be required, an agreement would be needed to impose that rule. The default rule is that either co-author may act on behalf of both (and when there are more than two co-authors, any one may act on behalf of all).
If it was claimed that the work infringes someone else's copyright or patent, both co-authors would be liable in the absence of any agreement to the contrary. In a lawsuit over licensing or marketing, only those who were party to the deal would normally be liable. I can't think what other kind of suit over such an app would be at all likely.