Bullets are cheap, but an AI airplane with a gun is far more expensive than almost any fire and forget missile since it is effectively a larger, more complex, more expensive fire and forget missile.
The only way a gun might be more efficient is in a situation with total air supremacy like Iraq or Afghanistan, and the targets would ideally be in the open.