European foreign policy of the 18th century revolved around maintaining the "balance of power." Prussia and Austria, for example, constantly argued with each other over the control of Germany. Unfortunately, the minor German states suffered from these disputes because they became the battlegrounds of the two great powers. The German state of Bavaria became one such battleground in 1778.
On December 30, 1777, Maximilian Joseph died of smallpox and the Electorate of Bavaria passed to his heir Charles Theodore, Elector Palatine. Theodore had no legitimate children but he did have several illegitimate children whom he wanted Austria to recognize as princes and financially provide for them. Therefore, he made a secret treaty with Joseph II of Austria whereby, in exchange for recognition of his illegitimate sons as princes of the Holy Roman Empire, he would cede Lower Bavaria and the lordship of Mindelheim to Austria. This transition of power strengthened Austrian influence in southern Germany and caused the balance of power in Germany to shift in Austria's favor. This shift in the status quo caused the Bavarian War of Succession.
This transfer of territory may have been mutually satisfying for Austria and Bavaria but not to the Duke of Zweibrücken Karl Augusts Christian, Theodore's heir presumptive, who protested this territorial transfer. He objected because the ceded territory was his inheritance. Frederick II of Prussia declared war on Austria on July 3, 1778 and invaded Bohemia on July 5, 1778 to maintain the Balance of Power between the two great powers.
There were no battles in this war because neither side craved war. The dispute was settled at the Congress of Teschen where the two rivals signed a treaty on May 13, 1779. Austria gave up its claim to Bavaria in return for a small section near its border. Austria would in turn recognize Prussia's claim to Ansbach and Bayreuth thus restoring the status quo.
Resources
The Bavarian War of Succession
On the Wikipedia website, you can read a general overview of the War of Succession.
Bavarian History
The Bavarian governmental website has a great general history of the country.