Search Issue Tracker

Won't Fix

Votes

11

Found in

2021.3.3f1

2022.1.5f1

2023.2.0a1

Issue ID

UUM-8784

Regression

Yes

[Android] Using Release configuration of minification with target API level 33 results in failed build

--

-

To reproduce:
1. Open any project and switch to Android platform
2. In Player Settings > Publishing Settings > Minify, tick Release 
3. In Player Settings > Other Settings > Identification, select Target API level as 33

4. Build the app

Result: Gradle errors are thrown when application is being built:
"Unsupported version number [55.0] (maximum 54.0, Java 10)"

Important information:
• Build does not fail if R8 minification is enabled (neither single, nor together with Release)
• Does not reproduce when Target API level is <33
• Building on 2022.2.0b1, 2023.1.0a3 no longer  results in errors since (as [~julius] also confirmed) the non-R8 method is no longer available after the ["SDK32, AGP7 & JDK11 upgrade"|https://jira.unity3d.com/browse/PLAT-70]

Full error:

CommandInvokationFailure: Gradle build failed. 
/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Note: /Users/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/java/com/unity3d/player/UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:minifyReleaseWithProguard'.
> java.io.IOException: Can't read [/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/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 1s
]
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 :launcher:extractProguardFiles UP-TO-DATE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:processReleaseJavaRes NO-SOURCE
> Task :launcher:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:packageReleaseResources
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:processReleaseManifest
> 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 :unityLibrary:packageReleaseAssets
> Task :launcher:processReleaseManifest
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:mergeReleaseJavaResource UP-TO-DATE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :launcher:mergeReleaseAssets
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:collectReleaseDependencies UP-TO-DATE
> Task :launcher:configureReleaseDependencies UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:parseReleaseIntegrityConfig UP-TO-DATE
> Task :launcher:validateSigningRelease UP-TO-DATE
> Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:mergeReleaseResources
> Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
> Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources
> Task :launcher:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:stripReleaseDebugSymbols UP-TO-DATE
> Task :unityLibrary:compileReleaseLibraryResources
> Task :unityLibrary:generateReleaseRFile

> Task :unityLibrary:compileReleaseJavaWithJavac

> Task :unityLibrary:mergeReleaseGeneratedProguardFiles UP-TO-DATE
> Task :unityLibrary:exportReleaseConsumerProguardFiles UP-TO-DATE
> Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
> Task :unityLibrary:bundleLibCompileToJarRelease
aapt2 W 07-12 20:30:17 39980 884762 LoadedArsc.cpp:657] Unknown chunk type '200'.

aapt2 W 07-12 20:30:17 39981 884761 LoadedArsc.cpp:657] Unknown chunk type '200'.

> Task :launcher:processReleaseResources
> Task :launcher:compileReleaseJavaWithJavac
> Task :launcher:mergeReleaseGeneratedProguardFiles UP-TO-DATE

> Task :launcher:minifyReleaseWithProguard FAILED
ProGuard, version 6.0.3
Reading input...
Reading program jar [/Users/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/unity-classes.jar] (filtered)
Reading program jar [/Users/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/build/intermediates/runtime_library_classes_jar/release/classes.jar] (filtered)
Reading program jar [/Users/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/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/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/javac/release/classes] (filtered)
Reading program jar [/Users/vaidasm/Documents/GitHub/AndroidApplicationStates-TestProject/AndroidApplicationStates-TestProject/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/merged_java_res/release/out.jar] (filtered)
Reading library jar [/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/android.jar]
Reading library jar [/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/SDK/build-tools/30.0.2/core-lambda-stubs.jar]
Reading library jar [/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/org.apache.http.legacy.jar]
Reading library jar [/Applications/Unity/2022.1.5f1_feea5ec8f162_x64/Unity.app/Contents/PlaybackEngines/AndroidPlayer/SDK/platforms/android-33/optional/android.car.jar]

> Task :launcher:bundleReleaseResources
44 actionable tasks: 15 executed, 29 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <0a73306121134534ae1615b7e181096c>: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 <0a73306121134534ae1615b7e181096c>: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 <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0a73306121134534ae1615b7e181096c>: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 <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <0a73306121134534ae1615b7e181096c>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0a73306121134534ae1615b7e181096c>: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)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

!image-2022-07-12-20-37-19-673.png!

  1. Resolution Note:

    Proguard used in Android Gradle Plugin 4.0.2 can't process libs compiled with Java 11. Newer Android Gradle Plugin versions use R8 tool instead of Proguard. Workaround is to enable "Use R8" checkbox in Player Settings.

Comments (5)

  1. metgens

    Mar 11, 2023 14:06

    2021.3.16f1 - still happens

  2. YousafGrewal

    Dec 18, 2022 07:30

    Yes, its happening in 2021.3.15f1

  3. PixelsGraphicDesign

    Dec 06, 2022 21:29

    Guessing Unity doesnt care because they are trying to make us use Unity Ads (which have yielded much lower income for me btw).

  4. flintcheeze

    Nov 27, 2022 06:28

    Can also comfirm this is happening in Unity 2021.3.11f1 presently testing it out it R8 enabled

  5. Wantcha

    Aug 22, 2022 10:44

    Can confirm this happening on 2021.3.7f1. How has Unity not acknowledged this issue yet?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.