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 JAVA TOOL error on compile

Discussion in 'Editor & General Support' started by PolyMad, Aug 14, 2023.

  1. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    I am getting these errors on compile:

    Code (JavaScript):
    1. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    2. M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:164: error: cannot find symbol
    3.         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
    4.                                                         ^
    5.   symbol:   variable TIRAMISU
    6.   location: class VERSION_CODES
    7. M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:165: error: cannot find symbol
    8.             permissionGranted = mContext.checkCallingOrSelfPermission(Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;
    9.                                                                                          ^
    10.   symbol:   variable POST_NOTIFICATIONS
    11.   location: class permission
    12. Note: M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
    13. Note: Recompile with -Xlint:deprecation for details.
    14. Note: Some input files use unchecked or unsafe operations.
    15. Note: Recompile with -Xlint:unchecked for details.
    16. 2 errors
    17.  
    18. FAILURE: Build failed with an exception.
    19.  
    20. * What went wrong:
    21. [B][COLOR=#ff0000]Execution failed for task ':unityLibrary:compileReleaseJavaWithJavac'.[/COLOR][/B]
    22. > Compilation failed; see the compiler error output for details.
    23.  
    24. * Try:
    25. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    26.  
    27. * Get more help at https://help.gradle.org
    28.  
    29. BUILD FAILED in 2s
    30.  
    31. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    32.  
    Code (JavaScript):
    1. CommandInvokationFailure: [B][COLOR=#ff0000]Gradle build failed[/COLOR][/B].
    2. C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    3.  
    4. Environment Variables:
    5. [COLOR=#ff0000][B]OculusBase = C:\Program Files\Oculus\[/B][/COLOR]
    6. USERDOMAIN = POLYMAD-PC
    7. ProgramFiles = C:\Program Files
    8. TMP = C:\Users\PolyMad\AppData\Local\Temp
    9. PROCESSOR_ARCHITECTURE = AMD64
    10. PROCESSOR_REVISION = 5e03
    11. OS = Windows_NT
    12. CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_22868_JABSTVIIRYFECMSU
    13. PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
    14. AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
    15. USERPROFILE = C:\Users\PolyMad
    16. JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
    17. [B][COLOR=#ff0000]ADSK_3DSMAX_x64_2021 = C:\Program Files\Autodesk\3ds Max 2021\[/COLOR][/B]
    18. DriverData = C:\Windows\System32\Drivers\DriverData
    19. ComSpec = C:\WINDOWS\system32\cmd.exe
    20. LAUNCH_DARKLY_CLIENT_TOKEN = 60a7e30fafc7e60e33446283
    21. PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
    22. PUBLIC = C:\Users\Public
    23. SystemRoot = C:\WINDOWS
    24. HEAP_CLIENT_TOKEN = 1717415662
    25. NUMBER_OF_PROCESSORS = 4
    26. [B][COLOR=#ff0000]ADSK_3DSMAX_x64_2018 = C:\Program Files\Autodesk\3ds Max 2018\[/COLOR][/B]
    27. WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
    28. JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
    29. DEBUG_ENV_VAR = UnityHub
    30. ProgramW6432 = C:\Program Files
    31. FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
    32. TEMP = C:\Users\PolyMad\AppData\Local\Temp
    33. Path = C:\Program Files\Oculus\Support\oculus-runtime;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Common Files\Acronis\FileProtector\;C:\Program Files (x86)\Common Files\Acronis\FileProtector64\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Prio;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\PolyMad\AppData\Local\Microsoft\WindowsApps;C:\Users\PolyMad\.dotnet\tools
    34. USERNAME = PolyMad
    35. COMPUTERNAME = POLYMAD-PC
    36. USERDOMAIN_ROAMINGPROFILE = POLYMAD-PC
    37. PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    38. SystemDrive = C:
    39. ALLUSERSPROFILE = C:\ProgramData
    40. SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
    41. HEAP_CLIENT_TOKEN_STAGING = 3786794399
    42. FPS_BROWSER_USER_PROFILE_STRING = Default
    43. windir = C:\WINDOWS
    44. AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
    45. CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
    46. APPDATA = C:\Users\PolyMad\AppData\Roaming
    47. CommonProgramFiles = C:\Program Files\Common Files
    48. PROCESSOR_LEVEL = 6
    49. CommonProgramW6432 = C:\Program Files\Common Files
    50. ProgramFiles(x86) = C:\Program Files (x86)
    51. SESSIONNAME = Console
    52. LOGONSERVER = \\POLYMAD-PC
    53. LOCALAPPDATA = C:\Users\PolyMad\AppData\Local
    54. HOMEPATH = \Users\PolyMad
    55. LAUNCH_DARKLY_CLIENT_TOKEN_STAGING = 60a7e30fafc7e60e33446282
    56. HOMEDRIVE = C:
    57. [COLOR=#ff0000][B]OneDrive = C:\Users\PolyMad\OneDrive[/B][/COLOR]
    58. ProgramData = C:\ProgramData
    59. ORIGINAL_XDG_CURRENT_DESKTOP = undefined
    60.  
    61.  
    62. stderr[
    63. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    64. M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:164: error: cannot find symbol
    65.         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
    66.                                                         ^
    67.   symbol:   variable TIRAMISU
    68.   location: class VERSION_CODES
    69. M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity\androidnotifications\UnityNotificationManager.java:165: error: cannot find symbol
    70.             permissionGranted = mContext.checkCallingOrSelfPermission(Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;
    71.                                                                                          ^
    72.   symbol:   variable POST_NOTIFICATIONS
    73.   location: class permission
    74. [B][COLOR=#ff0000]Note: M:\WORK\_SGR\SGR\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.[/COLOR][/B]
    75. Note: Recompile with -Xlint:deprecation for details.
    76. Note: Some input files use unchecked or unsafe operations.
    77. Note: Recompile with -Xlint:unchecked for details.
    78. 2 errors
    79.  
    80. FAILURE: Build failed with an exception.
    81.  
    82. * What went wrong:
    83. [B][COLOR=#ff0000]Execution failed for task ':unityLibrary:compileReleaseJavaWithJavac'.[/COLOR][/B]
    84. > Compilation failed; see the compiler error output for details.
    85.  
    86. * Try:
    87. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    88.  
    89. * Get more help at https://help.gradle.org
    90.  
    Code (JavaScript):
    1.  
    This is a brand new installation of Unity 2022.3.7f1.
    Any idea what's happening?
    Why it's tracking OCULUS?
    Why it's tracking ONEDRIVE, which I don't use?
    Why it's tracking 3DS Max?
    This is all stuff that shouldn't happen, I touched nothing, and all the errors refer to Java inside Unity.
     
    Last edited: Aug 14, 2023
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    How to troubleshoot build failures:

    First, make a blank project with a single blank scene and prove that it builds successfully.

    If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

    Until you can build a blank project to the target platform, don't fiddle with anything else.

    Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

    Most often things that prevent building are third-party libraries such as Firebase.

    Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

    It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

    Android build not building:

    Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

    https://forum.unity.com/threads/cant-build-for-android.1306098/

    Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

    https://forum.unity.com/threads/aab...y-2021-3-8-with-jdk-1-8.1322211/#post-8551193

    Android Gradle errors and other related stuff:

    https://forum.unity.com/threads/unity-gradle-bug-please-help.1368018/#post-8625789
     
  3. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    Thank you very much, man.
    But this is crazy.
    I am in no way able to solve this, I'm no professional programmer and all these systems are out of my knowledge.
    I didn't install Firebase or anything that could mangle the core of Unity or anything else.
    I installed Playmaker, TextMeshPro, and this version again poses the problem of finding the Sprite Editor, which looks completely missing, so I'm also stuck with the sprites.
    This LTS version is really terrible...
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    This is very unfortunate but I tend to agree. I hope they get things back on track ASAP.
     
  5. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    Tested with brand new template 3D mobile project: does not compile.

    BTW: I don't have ANY other tool installed. I only use the Unity installation. EXACTLY to try to avoid this type of problems, which I'm not able to solve.
    And guess what happens? I get f anyway.
     
    Last edited: Aug 14, 2023
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,632
    To solve this problem, you need Android SDK 33. A simple solution is to set your target SDK to 33 in player settings.
    If you wish to use lower target sdk, then you'll need a custom gradle template with compileSdk set to 33 (Unity sets it to the same as target sdk).
     
    PolyMad likes this.
  7. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    Thank you, man, but I don't know exactly what you are talking about: I am using the SDK installed by Unity, I didn't change ANYTHING in the preferences after installation of the latest LTS version.

    Should I install another SDK to get v.33?
    And then set Unity to use that?
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,632
    Select 33 as target in Player Settings and Unity should automatically download and install it, if not present.
    By the end of this month Google Play will require all new apps and updates to target 33.
     
    PolyMad likes this.
  9. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    upload_2023-8-15_1-30-15.png

    Should I select it here?
    Android 13?

    Should I select on both Minimum API Level and Target API Level?
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,632
    I think you've clicked on Minimum SDK. The Target SDK is below it. Yes, select 13 for target, minimum doesn't matter.
     
  11. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,323
    Oh ok, thank you again.

    Edit: btw this worked! I am so happy :D
     
    Last edited: Aug 18, 2023