Neither of those are fair use defences.
I reached out to Collard, a partner at Dorsey & Whitney, who specializes in intellectual property... "In my opinion, the biggest problem for Google is the commercial nature of its use [of the APIs]," he said. "That is generally a strike against finding fair use. Its best argument is probably interoperability -- in other words, it should be fair use because Google must use the APIs in order to make its products interoperable."
[1]: https://www.cs.duke.edu/courses/cps182s/fall02/cscopyright/C...
[2]: https://adtmag.com/blogs/watersworks/2015/07/google-java-api...