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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Compiling Error: Major Version 52 is newer than 51....

Discussion in 'Editor & General Support' started by Powdered_sugar, Jun 21, 2016.

  1. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Hello all. I'm trying to compile a project for android, and have randomly had this error start happening every time I try to compile the .apk. (Specifically, in the "Compile Android Resource Files." portion of the build)



    My java version is:
    java version "1.7.0_79"
    Java(TM) SE Runtime Environment (build 1.7.0_79-b15)

    My environment variables are:
    JAVA_HOME : C:\Program Files\Java\jdk1.7.0_79\bin
    JRE_HOME: C:\Program Files\Java\jre7


    I just tried uninstalling and reinstalling java, which didn't work. This is the only version of Java installed on this machine. The only thing I seem to find about this error is that JAVA_HOME and JRE_HOME are not pointing to the correct folders, which is not the case here.


    Thank you for any help you can give me.
     
  2. CurryChen

    CurryChen

    Joined:
    Jun 8, 2016
    Posts:
    2
    Hi, my situation is similar to yours, here's my part of error messages:

    After I installed new JDK, the problem solved.
    (I download jdk-8u91-windows-x64.exe)

    This is my environment setting, you can try it:

    [Set up Environment Variable]

    1. at User Variables, add a new variable named JAVA_HOME: C:\Program Files\Java\jdk1.8.0_91
    2. at System Variables, in variable Path, add C:\Program Files\Java\jdk1.8.0_91\bin

    Restart computer.

    Open Unity, go to Preferences, set up path of Android SDK and JDK

    Restart Unity.
     
    Flicker_ and R3tr0BoiDX like this.
  3. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    I tried this and it didn't work. Still, this is the answer I've seen the most, so I'll have to try again. Thank you for the answer, I hope it works this time.
     
  4. CurryChen

    CurryChen

    Joined:
    Jun 8, 2016
    Posts:
    2
    And I also updated android SDK to the newest version, probably not useful, but you can try.
     
  5. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    36
    Any one managed to fix this?
     
  6. tjunqueira

    tjunqueira

    Joined:
    Aug 24, 2015
    Posts:
    2
    I installed the jdk-8u102 and it worked fine!!

    Although, remember to change the path at Unity as CurryChen said,

    Go to Edit -> Preferences (at Unity), then External tools and set up the path of JDK to C:/Program Files/Java/jdk1.8.0_102, or wherever path you installed your java.

    Hope it help!!
     
    BrennanH, perplex_bcn and Ashwin_NID like this.
  7. Ashwin_NID

    Ashwin_NID

    Joined:
    Sep 18, 2014
    Posts:
    1
    Works by updating to the latest available java sdk version and updating environment variables + unity external tools
     
    BrennanH likes this.
  8. GabLeRoux

    GabLeRoux

    Joined:
    Dec 19, 2013
    Posts:
    8
    Getting very similar error message. I'm running Unity 5.3.6f1 (maybe updating could help, I didn't try). I took a few notes while trying to solve this.

    I have a few jdk installed, but my system is using the following:

    shows nothing (on Arch, no need to set $JAVA_HOME, we use the archlinux-java command) ;)

    I tried switching from one to the other with archlinux-java command but it did nothing.

    I tried reinstalling sdk from scratch using Android-Studio and I made sure Unity is using the same sdk path. Didn't do anything.

    I found the following related Q/A on unity3d answers.

    I double checked Unity settings and I saw that it was using the following jdk path:
    I changed it to

    Maybe using $JAVA_HOME could have helped, but I haven't tried.

    Turns out I'm now getting the following error:
    Related thread

    I had this second problem in the past and the solution was to remove google-play-services lib and other libs completely before upgrading them (installing them from scratch).

    I checked out a commit I know it was building ok and cleaned up all temp and ignored files with the following command (watch out, it's pretty dangerous if you don't know what you're doing!)

    Reopened Unity and now it's building ok again! :)

    tldr
    Make sure jdk and android-sdk are up to date, double check paths in Unity settings > External tools for both sdk and jdk path.
     
    Last edited: Aug 1, 2016
  9. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    Thank you all for getting me past this.
     
  10. seanNovak

    seanNovak

    Joined:
    Aug 12, 2013
    Posts:
    12
    Installing JDK 1.8 fixed this for me also.
     
  11. GabLeRoux

    GabLeRoux

    Joined:
    Dec 19, 2013
    Posts:
    8
    Ahah, I had this error again, but on MacOS this time.
    Gave me
    This problem definitely happens when using jdk1.7 instead of jdk1.8.

    On MacOS, you shoul use brew to install stuff. To make sure JAVA (jdk) is on the latest version:
    You can find your available JDKs with this:
    So I used the following path in Unity:
    And it worked just fine.
     
    Last edited: Feb 18, 2017
  12. SNSD

    SNSD

    Joined:
    Jun 17, 2014
    Posts:
    5
    update your java jdk to "jdk1.8" then
    Go to Edit -> Preferences (at Unity), then External tools and set up the path of JDK to C:/Program Files/Java/jdk1.8.0_102, or wherever path you installed your java.
     
    David-Hernan likes this.
  13. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    Thanks, worked for me.
     
  14. Flicker_

    Flicker_

    Joined:
    Sep 29, 2015
    Posts:
    6
    Updating the JDK worked for me as well. Be sure in Unity you go to Preferences>external tools and be sure that the JDK is directed to the correct version 1.8.0 not 1.7.0
     
  15. LyonStoleMyBike

    LyonStoleMyBike

    Joined:
    May 9, 2017
    Posts:
    1
    You all rock, thank you! I would just note that i was in the program files x86 instead of program files for my 64 bit. once i looked in the proper place, i found the installation of jdk1.8
     
  16. BeshevGames

    BeshevGames

    Joined:
    Apr 8, 2016
    Posts:
    8
    For me nothing helps - I updated everything and it still says that it can't sign the app, when I use the default build system - Internal, the Gradle works, but I don't know why the Internal doesn't. Tested it on a new project - same! I didn't have this problem before :( . Any ideas?

     
  17. rumrowi

    rumrowi

    Joined:
    May 31, 2017
    Posts:
    1

    It's work for me. Thank you !
     
  18. dheerajbhadani

    dheerajbhadani

    Joined:
    Nov 11, 2017
    Posts:
    1
    I installed jdk-8u151. Updated the environment variables and set path in Unity.
    It worked for me.

    Cheers,
     
  19. Deleted User

    Deleted User

    Guest

    I did this but got the following error:
    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_91\bin\java.exe -classpath "C:\Program Files\UnitySelfieChimp\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring root project 'gradleOut'.
    > Failed to find Build Tools revision 28.0.0
     
  20. Gold_Rush

    Gold_Rush

    Joined:
    Jan 10, 2018
    Posts:
    64
    I'm recived this error after i updated in Android SDK Manager:
    Build tools from rev. 22 to rev.28;
    and SDK platform from Android 5.0.1 (rev 21) to Android 9 (rev 28).

    I did it because Google Play since recent time does not allow to upload APK apps with revision less than 26.

    For fix this mistake i'm downloaded and installed jdk-8u40-windows-i586.exe (because revision 40 installed perfectly on Win XP unlike to the first and latest versions) you can download any version of JDK archive on Oracle site.

    And in Unity menu Edit->Preferences->External Tools i'm change old JDK path to new JDK8. In my case "C:/Program Files/Java/jdk1.8.0_40".

    You may still need to restart your computer.

    After these steps, Android APK's is assembles correctly.

    Perhaps this info will help someone.