Had Duda released his code under GPLv3, he would have quit his own patent claims, not prevented Google from asserting theirs.
In general, there is no way to prevent patent claims on your work other than to defensively patent every conceivable application of it. That is why all major corporations have large portfolios of such patents.
In theory one should not need to defensively patent anything that is published openly since the patent office should not grant any patents for ideas which has already been published. It is only if we accept that the patent office is utterly broken and do not check for prior art that defensively patent every conceivable application of public released work is a good idea.
In general, there is no way to prevent patent claims on your work other than to defensively patent every conceivable application of it. That is why all major corporations have large portfolios of such patents.