Unreal packaging error because of Java error

I’m trying to package my project on UE4.27 for the oculus quest so I selecting package>android and everything starts working fine but then I run into the error Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread "Daemon worker"]. I’ve just changed my android SDK and NDK downloads since I needed to roll back to an older version for it to be supported so I don’t know if that has anything to do with it. I originally had everything set up for UE5 but needed to change over to UE4 so that’s right I had to redo my SDK and NDK downloads

same problem pls help me