Search Unity

.AAB Build Targeting API Level 33 on Unity 2021.3.8 with JDK 1.8.

Discussion in 'Android' started by pabloware, Aug 13, 2022.

  1. pabloware

    pabloware

    Joined:
    Oct 22, 2020
    Posts:
    15
    I am attempting to upload an .AAB file Google Play Console which requires an API level of 31 or higher. But targeting an API higher than 30 in Unity results in a build failure. Below are my error logs. Any guidance would be appreciated.

    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':launcher:minifyReleaseWithProguard'.
    > java.io.IOException: Can't read [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/android.car.jar] (Can't process class [android/car/Car$CarServiceLifecycleListener.class] (Unsupported version number [55.0] (maximum 54.0, Java 10)))

    * Try:
    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.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)


    NEXT


    CommandInvokationFailure: Gradle build failed.
    /Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"

    Environment Variables:
    BURST_ANDROID_MIN_API_LEVEL = 22
    XPC_FLAGS = 0x0
    JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
    PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

    TMPDIR = /var/folders/c0/r692bsvn4sg6_wh6w21f6xzm0000gn/T/
    SHELL = /bin/zsh
    SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.ivEgkKXhAB/Listeners
    HOME = /Users/pauldesautels
    __CFBundleIdentifier = com.unity3d.unityhub
    USER = pauldesautels
    __CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x52
    LOGNAME = pauldesautels
    ORIGINAL_XDG_CURRENT_DESKTOP = undefined
    JAVA_HOME = /Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/OpenJDK
    ANDROID_NDK_ROOT = /Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/NDK
    XPC_SERVICE_NAME = application.com.unity3d.unityhub.14286249.14286255
    COMMAND_MODE = unix2003


    stderr[
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':launcher:minifyReleaseWithProguard'.
    > java.io.IOException: Can't read [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/android.car.jar] (Can't process class [android/car/Car$CarServiceLifecycleListener.class] (Unsupported version number [55.0] (maximum 54.0, Java 10)))

    * Try:
    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.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s
    ]
    stdout[

    > Configure project :launcher
    WARNING: The option setting 'android.enableR8=false' is deprecated.
    It will be removed in version 5.0 of the Android Gradle plugin.
    You will no longer be able to disable R8

    > Task :launcher:preBuild UP-TO-DATE
    > Task :unityLibrary:preBuild UP-TO-DATE
    > Task :unityLibrary:preReleaseBuild UP-TO-DATE
    > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
    > Task :UnityDataAssetPack:generateAssetPackManifest UP-TO-DATE
    > Task :launcher:extractProguardFiles UP-TO-DATE
    > Task :launcher:preReleaseBuild UP-TO-DATE
    > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
    > Task :unityLibrary:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:packageReleaseResources UP-TO-DATE
    > Task :launcher:processReleaseAssetPackManifests UP-TO-DATE
    > Task :launcher:linkReleaseManifestForAssetPacks UP-TO-DATE
    > Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
    > Task :unityLibrary:processReleaseManifest UP-TO-DATE
    > Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
    > Task :unityLibrary:compileReleaseAidl NO-SOURCE
    > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
    > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
    > Task :unityLibrary:processReleaseJavaRes NO-SOURCE
    > Task :unityLibrary:bundleLibResRelease NO-SOURCE
    > Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
    > Task :unityLibrary:compileReleaseShaders NO-SOURCE
    > Task :unityLibrary:generateReleaseAssets UP-TO-DATE
    > Task :launcher:assetPackReleasePreBundleTask UP-TO-DATE
    > Task :launcher:compileReleaseRenderscript NO-SOURCE
    > Task :launcher:generateReleaseResValues UP-TO-DATE
    > Task :launcher:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:packageReleaseAssets
    > Task :launcher:mergeReleaseResources UP-TO-DATE
    > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
    > Task :launcher:extractDeepLinksRelease UP-TO-DATE
    > Task :unityLibrary:mergeReleaseJniLibFolders
    > Task :launcher:processReleaseManifest UP-TO-DATE
    > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
    > Task :launcher:bundleReleaseResources UP-TO-DATE
    > Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
    > Task :launcher:compileReleaseAidl NO-SOURCE
    > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
    > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:mergeReleaseGeneratedProguardFiles UP-TO-DATE
    > Task :launcher:javaPreCompileRelease UP-TO-DATE
    > Task :unityLibrary:exportReleaseConsumerProguardFiles UP-TO-DATE
    > Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
    > Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
    > Task :launcher:processReleaseResources UP-TO-DATE
    > Task :unityLibrary:mergeReleaseNativeLibs
    > Task :launcher:compileReleaseJavaWithJavac UP-TO-DATE
    > Task :unityLibrary:stripReleaseDebugSymbols
    > Task :launcher:mergeReleaseGeneratedProguardFiles UP-TO-DATE
    > Task :launcher:processReleaseJavaRes NO-SOURCE
    > Task :launcher:mergeReleaseJavaResource UP-TO-DATE
    > Task :unityLibrary:copyReleaseJniLibsProjectOnly

    > Task :launcher:minifyReleaseWithProguard FAILED
    ProGuard, version 6.0.3
    Reading input...
    Reading program jar [/Users/pauldesautels/Documents/Pabloware/LEGENDARY_LARRY/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/unity-classes.jar] (filtered)
    Reading program jar [/Users/pauldesautels/.gradle/caches/transforms-2/files-2.1/b6257d464e65990d4b3bc83730a9e910/UnityAds-runtime.jar] (filtered)
    Reading program jar [/Users/pauldesautels/.gradle/caches/transforms-2/files-2.1/f50f8f4811bb1868446a8fa8c1e81c2d/common-runtime.jar] (filtered)
    Reading program jar [/Users/pauldesautels/.gradle/caches/transforms-2/files-2.1/309637c8fe751374308e3a44ad5c886d/billing-4.0.0-runtime.jar] (filtered)
    Reading program jar [/Users/pauldesautels/.gradle/caches/transforms-2/files-2.1/6e1f69c9173f6b668c6234c95ac4c036/core-1.10.0-runtime.jar] (filtered)
    Reading program jar [/Users/pauldesautels/Documents/Pabloware/LEGENDARY_LARRY/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/build/intermediates/runtime_library_classes_jar/release/classes.jar] (filtered)
    Reading program jar [/Users/pauldesautels/Documents/Pabloware/LEGENDARY_LARRY/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/release/R.jar] (filtered)
    Reading program directory [/Users/pauldesautels/Documents/Pabloware/LEGENDARY_LARRY/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/javac/release/classes] (filtered)
    Reading program jar [/Users/pauldesautels/Documents/Pabloware/LEGENDARY_LARRY/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/merged_java_res/release/out.jar] (filtered)
    Reading library jar [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/android.jar]
    Reading library jar [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/build-tools/30.0.2/core-lambda-stubs.jar]
    Reading library jar [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/org.apache.http.legacy.jar]
    Reading library jar [/Applications/Unity/Hub/Editor/2021.3.8f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/android.car.jar]
    39 actionable tasks: 6 executed, 33 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <4a8943a7ff7048deb64e0a5059f78d1d>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
     
  2. SkylorBeck

    SkylorBeck

    Joined:
    Aug 29, 2020
    Posts:
    13
    Any luck? Same error
     
  3. topandroidd

    topandroidd

    Joined:
    Dec 26, 2018
    Posts:
    1
    same error still stucks
     
  4. B4ckBencher

    B4ckBencher

    Joined:
    Oct 11, 2021
    Posts:
    1
    hi same error
    Any solution?
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    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/

    If it's not that, then here's how to troubleshoot:

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

    If it does NOT build, then go fix your Unity installation, or your other tools, such as Android SDK, NDK, JDK, etc.

    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 that subsystem.
     
  6. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,963
    Let us give a try. Share us your unity version!
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Hey, coincidentally I just upgraded to Android SDK31 today... why not wait until nearly the last minute?

    It was a wild ride, took most of the day. Let me tell you what I did, what I found.

    First of all, I'm using Unity2020.3.41 (hereinafter referred to Unity*) because that's all the further I need to go forward right now.

    I found that Unity* only accepts up to SDK30.0.3 tools, but will build using those tools and SDK31.

    Next I found that Android Studio will not install anything except Android 33 FIRST, and only after you get 33 can you uninstall 33 and simultaneously install earlier versions.

    So I went to a bastardized setup where I used the Unity-provided installs for everything except the Android SDK, for which I downloaded SDK 31 and the tools for 30, putting it over in ~/Library/Android/sdk... and it worked!

    I have now built and tested two games to Android 64bit IL2CPP and they have been accepted by the Google Play store internal testing track with zero warnings, but I have not yet tried to push them to production, which I think triggers a few more SDK checks.

    EDIT from 8/23/2023 - I upgraded the above from SDK31 to SDK33 as follows: Without telling Unity anything I used Android Studio to remove SDK31 fully and to install SDK33.
     
    Last edited: Aug 24, 2023
  8. coyousi11

    coyousi11

    Joined:
    Feb 4, 2022
    Posts:
    1
    @pabloware
    To upgrade to API level higher than 29, follow up-
    1) Download Android Studio, go to Settings > System Settings > Android SDK.
    2) On SDK Platforms tab, select-
    Android API 32(Sv2) 32(API Level)
    Android 12.0(S) 31(API Level)
    Android 11.0(R) 30(API Level)
    3) On SDK Tools tab, click on Show Package Details at bottom right corner and select,
    32.0.0
    31.0.0
    30.0.3 ,and click OK
    4) Open Unity's SDK location (C:\Program Files\Unity\Hub\Editor\"Editor Version"\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)
    Copy SDK Platforms from Android Studio and paste in platforms folder at the above location.
    Copy SDK Tools from Android Studio and paste in build tools folder at the above location.
    5) Copy dx.bat from SDK\build tools\30.0.3 and paste in SDK\build tools\31.0.0 and 32.0.0
    6) Copy dx.jar from SDK\build tools\30.0.3\lib and paste in SDK\build tools\31.0.0\lib and 32.0.0\lib

    You are all done, now choose your target API level and build the file.
    Do tell me, if you still face any issues.
     
    Last edited: Nov 14, 2022
    ekaraman, fazbrolabs and Jumeuan like this.
  9. salman1piece

    salman1piece

    Joined:
    Oct 14, 2020
    Posts:
    1
    I did as you instructed and got the same results "CommandInvokationFailure: Gradle build failed". I am using unity 2020.1.6. I had an extra issue, while copying tools from Android Studio > SDK to Unity's SDK I got an error "Destination path too long. You can shorten the file name and try again, or try a different location that has a shorter path". I skiped those few files.
     
    gmalc9090 likes this.
  10. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    What you should do is enable R8 under player settings
    Build should work just fine
     
    LexDeKogel likes this.
  11. LexDeKogel

    LexDeKogel

    Joined:
    Feb 1, 2016
    Posts:
    1
    I was struggling getting custom SDKs to work all day, but this finally worked for me. I don't really understand how it works, but thanks!

    For anyone looking for it it's Player settings > Android settings > Publisher Settings > Minify > Use R8
     
    Last edited: Mar 22, 2023
  12. fazbrolabs

    fazbrolabs

    Joined:
    Feb 6, 2020
    Posts:
    1
    You've Saved my 37-Days. I was totally shucked by this issue, Thanks
     
  13. GayanUthpala

    GayanUthpala

    Joined:
    Feb 3, 2016
    Posts:
    8
    I build APK Build Targeting API Level 33 on Unity 2019.2.0.f1. I followed all above step. But on Android 13 my app appear a black screen when it just run.
     
  14. katherine_puzzlenation

    katherine_puzzlenation

    Joined:
    Apr 28, 2022
    Posts:
    1
    Enabling R8 worked for me in terms of getting my project to build, but ended up causing a lot of other issues down the line when I tried to actually run my build on device.

    I noticed the file throwing the exception was under a folder called "optional" (/Applications/Unity/Hub/Editor/[unity version number]/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/android.car.jar) so I tried just deleting android.car.jar and that worked for me. Sharing in case it helps someone else.
     
  15. mitis

    mitis

    Joined:
    May 21, 2013
    Posts:
    51
    hi thank you helped me
     
  16. rajam9291

    rajam9291

    Joined:
    Oct 2, 2020
    Posts:
    2
    I have stuck in to update the api level 33 of my app
    i build the aab file with target api level 33 but its still showing min api level in google play console .pls help me.
    so i cant update my app.
     
  17. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,963
    Show the exact error you see on google play console as the quoted text is not clear.
     
  18. Solitari

    Solitari

    Joined:
    Jul 5, 2019
    Posts:
    17
    Using R8 didn't work for me, I'm going to try the Android Studio solution and build with a project already building, this will take a lot of work, almost the same as making a game without unity , I thought unity made life easier But I was wrong, it's making the programmer's life worse
     
    sampenguin likes this.
  19. ortenbergmaksim

    ortenbergmaksim

    Joined:
    Jul 17, 2023
    Posts:
    1
    Tried to update SDK didn't help.... Eventually I realized that the version of unity is not so important, updated several times. It is important that there are assemblies in it and that this pixel 2 should be enabled "x86-64(Chrome OS...)". Run on the emulator in android studio without problems. Unity version 2022.3.15.f1. Thanks coyousi11 for describing how to update SDK. Снимок.PNG