Even as early as World War 1 (1914-1918) - the war that introduced the aircraft as a viable combat platform - aircraft engineers were attempting to fix artillery-caliber weaponry onto fighters and bombers. Many tests were carried out though few found mainstream success until airframes were able to evolve along their own lines and grow into stronger gunnery platforms like those seen in the subsequent World War of 1939-1945.
American Commander Cleland Davis of the United States Navy (USN) was working on a device intended to mitigate the recoil forces of these large artillery weapons aboard aircraft and eventually delivered his "Davis Nonrecoiling Gun" for U.S. military service. The basic concept seen during 1911 used a gun tube that was open at both of its ends - breech and the muzzle. The tube was rifled along its inside walls to impart a rotating action upon the exiting projectile. A propellant charge and projectile were set within the tube while a recoil weight, consisting of a mixture of grease and lead balls, was set aft of the propellant/projectile pairing to act as a counterweight. When the charge was ignited, both the propellant and the counterweight were discharged from the gun tube in opposite directions, neutralizing (to an extent) the recoil force that would normally be at play with such a weapon.
Despite its value, it was only the USN service that took on the weapon in a notable role. These were mainly fitted to the larger flying boat seaplanes then in use and provided considerable firepower against enemy surface vessels (including surfaced submarines) and Zeppelins. In a typical arrangement, a Lewis-type trainable machine gun was fitted over the Davis Gun and used as a ranging instrument while retaining its basic anti-aircraft function. The USN would go on to use three different caliber of recoilless guns - spanning 47mm, 65mm and 75mm types - with each firing anything from a 2-pound to a 12-pound projectile. The British considered the Davis Gun for a time but elected not to pursue its large scale use.
The recoilless principle still remains in service today - though appropriately modernized in shoulder-fired weapon systems primarily used to defeat armor and fortifications. The Swedish Carl Gustav family of weapons is one of the most famous of the modern options.