Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug unity build android error AndroidLocationsProvider has been compiled by a more recent version of the

Discussion in 'Editor & General Support' started by hadi-beiki, Mar 6, 2023.

  1. hadi-beiki

    hadi-beiki

    Joined:
    Oct 23, 2013
    Posts:
    3
    hi
    i want to build android project in unity 2022.1.24f1 or in unity 2020 but in both of them i have this error for java runtime

    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:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    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)


    Error: A JNI error has occurred, please check your installation and try again
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    Exception in thread "main"

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    i change my java version but unity errored the version i support is 1.8
    i build in android 7 and 7.1 and i update my sdk to skd 32 but none of them worked
    how can i fix this?!
     
  2. kentJi

    kentJi

    Joined:
    Mar 11, 2016
    Posts:
    1
    we met this problem several weeks ago and solved by following steps:

    Go into Android Studio and under Tools → 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
    Return to Untiy and try build project again


    upload_2023-3-16_13-17-45.png
     
    Last edited: Mar 16, 2023
  3. JoJoJoX

    JoJoJoX

    Joined:
    Jun 23, 2022
    Posts:
    51
    Great! It works for me!
     
  4. Jasinka

    Jasinka

    Joined:
    Oct 18, 2016
    Posts:
    50
    Thank you, worked for me too! Connected just to say thanks!:)
     
  5. ficdich

    ficdich

    Joined:
    Jan 16, 2018
    Posts:
    1
    you are life saver man thank u very much
     
  6. SKGowrob

    SKGowrob

    Joined:
    Sep 12, 2021
    Posts:
    11
    thanks for the solve
     
  7. FaberVi

    FaberVi

    Joined:
    Nov 11, 2014
    Posts:
    145
    Thanks for the solve!
     
  8. Meroo1010

    Meroo1010

    Joined:
    Jun 6, 2022
    Posts:
    1
    bro i just want to tell you thank you so much
     
  9. GlzmoGamer

    GlzmoGamer

    Joined:
    Jun 23, 2023
    Posts:
    1
    now it says this
    UnityException: Android SDK is missing command-line tools.
    Android SDK command-line tools component is not found. Make sure "Command-line Tools (latest)" is installed in the SDK manager.
    If command-line tools are installed, but this message is still shown, please restart the Unity editor.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  10. berezina_yana

    berezina_yana

    Joined:
    Dec 27, 2022
    Posts:
    1
    I have the same problem. Have you solved it?
     
  11. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Thank you so much. This solved the problem!
     
  12. rrtt_2323

    rrtt_2323

    Joined:
    Mar 21, 2013
    Posts:
    19
    Uninstall Sdk Command-line Tools 11.0,
    And install 9.0 instead,
    Then restart Unity.
     
  13. cogito09

    cogito09

    Joined:
    Aug 30, 2017
    Posts:
    4
    THANK YOU, It solved my problem as well. You saved me a lot of time!