Setting up Android. Doing all the necessary steps like I always do. But now SetupAndroid.bat has this ERROR
Android Studio Path: C:\Program Files\Android\Android Studio
Android Studio SDK Path: C:\Users[Username]\AppData\Local\Android\Sdk
Using sdkmanager: C:\Users[Username]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Update failed. Please check the Android Studio install.
Press any key to continue . . .
I was getting the exact same error. I did this same install with UE 5.1 a few weeks ago and it worked fine. I compared the installs and it looks like there was an update to the Android command-line Tools.
Here’s how I fixed it:
Go into Android Studio and under Configure → SDK Manager
On the SDK Tools tab, select “Show Package Details” in the bottom right
Uncheck Android SDK command-line Tools (latest)
Check Android SDK command-line Tools 8.0
Click Apply
In Windows go to “C:\Users\USERNAME\AppData\Local\Android\Sdk\cmdline-tools” and rename the 8.0 folder to “latest”
Run SetupAndroid.bat again
I think that was everything. Basically just need to downgrade the command line tools. You could also go into the SetupAndroid.bat file and change the path from “latest” to 8.0 if you want, either way should work.