Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

issue with version 4.6.1 p4 and java

Discussion in 'Android' started by Felipe_Silva, Jan 16, 2015.

  1. Felipe_Silva

    Felipe_Silva

    Joined:
    Jan 16, 2015
    Posts:
    13
    windows version: 7 ultimate x64

    it worked just fine in unity 4.6.1 p2


    ERROR:
    ---------------------------------------------------------
    Error building Player: UnityException: Unable to find suitable jdk installation. Please make sure you have a suitable jdk installation. Android development requires at least JDK 7 (1.7). The latest JDK can be obtained from the Oracle
    http://www.oracle.com/technetwork/java/javase/downloads/index.html

    EDITOR LOG:
    ---------------------------------------------------------------
    Failed java version detection for 'C:\Java\jdk1.8.0_25\bin\java.exe'

    Incompatible java version 'C:\Java\jdk1.8.0_25\bin\java.exe'

    UnityEditor.Android.CommandInvokationFailure: Incompatible java version 'C:\Java\jdk1.8.0_25\bin\java.exe'
    C:\Java\jdk1.8.0_25\bin\java.exe -Xmx2048M -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    stderr[

    ]
    stdout[
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap
    ]

    at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

    Failed java version detection for 'C:\Java\jdk1.8.0_25\bin\java.exe'

    Incompatible java version 'C:\Java\jdk1.8.0_25\bin\java.exe'



    thx.
     
  2. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    19
    Same issue here. Resolved by switching JDK_HOME and JAVA_HOME to 64bit JDK (was 32bit for years).
     
    Last edited: Jan 18, 2015
    Yury-Habets likes this.
  3. Felipe_Silva

    Felipe_Silva

    Joined:
    Jan 16, 2015
    Posts:
    13
    thank! i will try it. :)
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,052
    Thanks for the heads up!

    Please use 64-bit Java for now. I'm taking a look at x86 Java issue.

    Update: this issue will be fixed in 4.6.1p5.
     
    Last edited: Jan 20, 2015
  5. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,008
    Reported here and via bug report as well
    http://forum.unity3d.com/threads/android-unable-to-build-jdk-error-unable-to-find-jdk.193318/page-2

    When will P5 be out? I have user crash reports which may be resolved by android patch releases and this is causing me some hassles.

    I can't use 64 bit Java atm as I have some other apps that rely on 32 bit.
    It would be great if Unity didn't make arbitrary changes and requirements to users environments, especially without informing them too.
     
  6. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    550
    Thats really strange - i definitely use P4 and the 32 bit JDK and have no problem whatsoever with Android builds ( Windows nor OSX ). Maybe it's because i still use Java 1.7.0_72, or because i have handtuned my java/JDK path enviroment setups , or maybe it's because i have all legacy Android SKD tools installed ...( including the most recent version and i think Unity always picks the most recent ... )
     
  7. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,052
    This is not a change to environment requirements.
    Maximum JVM memory for the commands was increased from 1024 to 2048M, to address some reported issues with large projects.
    This appeared to fail on Windows on 32bit Java, version 1.8+ because the executable output on OOM error has changed.
    The error will be fixed in 4.6.1p5, and has a workaround. (unfortunately I have no access to the plans when p5 is to be released, please follow the patch releases branch. Should be pretty soon anyway).

    Apologies for any inconvenience caused.
     
    Salazar likes this.
  8. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    550
    Ahh - thats it than - me still using 1.7 Java...

    As far i remember P5 release is planned for later this week, xxth if i remember correctly
    EDIT: just looked the date up again , should be 22th of January ...
     
    Last edited: Jan 23, 2015
  9. p3dart-es

    p3dart-es

    Joined:
    May 24, 2013
    Posts:
    201
    I want to say that, I installed Unity 4.6.1p4 because with the 4.6.1f1 version, when I try to build to Android, the game freezes when it just start to load.

    With the Unity 4.6.1p4 it is fixed. It build fine.

    But, I want to use Unity Ads. I downloaded the "unity-ads-demo-master", and imported the "Unity Ads package" from Asset Store, the Ads works fine in the editor, but, when I try to build to Android, I got an error about "javac.exe" file.

    I did read that I need to install JDK (I had JRE installed). After Installing jdk1.8.0_31 it shows the error:

    Error building Player: UnityException: Unable to find suitable jdk installation. Please make sure you have a suitable jdk installation. Android development requires at least JDK 7 (1.7). The latest JDK can be obtained from the Oracle
    http://www.oracle.com/technetwork/java/javase/downloads/index.html


    I have Windows 7 Professional 64 bits.
     
  10. p3dart-es

    p3dart-es

    Joined:
    May 24, 2013
    Posts:
    201
    I just installed JDK 64 bits and now I can build to Android again. But, when I try to build the "Unity Ads demo master", it shows the same error than before:

    Error building Player: Win32Exception: ApplicationName='javac.exe', CommandLine='-bootclasspath "C:/Program Files (x86)/Android/android-sdk/platforms/android-21\android.jar" -d "D:\PROYECTOS 3D VARIOS\UNITY ADS DEMO\unity-ads-demo-master\unity-ads-demo-master\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\prueba\espacioAds\R.java" "com\unity3d\ads\android\R.java"', CurrentDirectory='D:\PROYECTOS 3D VARIOS\UNITY ADS DEMO\unity-ads-demo-master\unity-ads-demo-master\Temp\StagingArea\gen'

    EDITED:

    FIXED!!!. I just change JAVA_HOME variable to the 64 bits path "C:\Program Files\Java\jdk1.8.0_31" and now it works!.
     
    Last edited: Jan 21, 2015
  11. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    236
    Code (CSharp):
    1. [C:/buildslave/unity/build/Editor/Src/Commands/IconUtility.cpp line 758]
    2. (Filename: C:/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs Line: 784)
    3.  
    4. Failed java version detection for 'C:\Program Files (x86)\Java\jdk1.8.0_31\bin\java.exe'
    5.  
    6. Incompatible java version 'C:\Program Files (x86)\Java\jdk1.8.0_31\bin\java.exe'
    7.  
    8. UnityEditor.Android.CommandInvokationFailure: Incompatible java version 'C:\Program Files (x86)\Java\jdk1.8.0_31\bin\java.exe'
    9. C:\Program Files (x86)\Java\jdk1.8.0_31\bin\java.exe -Xmx2048M -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
    10.  
    11. stderr[
    12.  
    13. ]
    14. stdout[
    15. Error occurred during initialization of VM
    16. Could not reserve enough space for 2097152KB object heap
    17. ]
    18.  
    19.   at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
    20.  
    21.   at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
    22.  
    23. Failed java version detection for 'C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java.exe'
    24.  
    25. Incompatible java version 'C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java.exe'
    There is no problem with build, but console logs this. I dont know if some features not working in my game, but it starts to happen today, i didnt changed anything.

    I am now downloading 4.6.2
     
  12. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,052
    Is it the console that logs this, or you only see this in the log? If this is the log - then we consider this not being an issue, just update to 64bit Java and set JAVA_HOME accordingly.