Theoretically you can re-write all the Oracle parts and then relicesne it. That is how BSD got out from AT&T years ago. This is hard to pull off legally and takes a long time. It is possible, but generally isn't practical.
And if the ongoing mudfight that is Oracle v. Google is any indicator, it's unclear that it would indeed even be legal (it should be, but God only knows how the courts are gonna end up ruling in the end).