There is a difference between making money from something and making money as a result of it.
Imagine Android was made by Mozilla. Then Oracle would have to be litigating against Mozilla and Mozilla's profits would be zero dollars because Android is free.
Meanwhile Google would still be making billions of dollars "from" Android in the same way they make billions of dollars "from" iOS.
Android is better for them because Apple controls iOS and can use that control to extract concessions or money from Google. So you would be entirely unsurprised if you learned that Google had cut Mozilla a big donation check. But that doesn't mean Google should owe Oracle money -- if there was no Android then more of Google's customers would have iOS (or something else) instead, and possibly more of Google's revenue would be going go Apple, but still none of it would have gone to Oracle.