Android build error on 2022.3.12

Hi,

I have been unable to build for Android on my PC since last week, after having done so successfully before. Before it stopped working my workplace changed my account from a domain to a workgroup, so I’m trying to look into if it’s related to that. But builds are working in 2021.3.16, and I’ve reinstalled 2022.3.12 after the account changed without any improvements.

On an empty project, when building to Android this is the error I get:

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Note: [path]\Library\Bee\Android\Prj\Mono2x\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:lintVitalAnalyzeRelease'.
> A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintWorkAction
> java.lang.reflect.InvocationTargetException (no error message)

This is using all the default Android installs shipped with 2022.3.12, which includes gradle version 7.1.2. I get the same issue whether I build with target SDK 32 or 33.

Any pointers to what the issue could be here?

Do you have any gradle templates set in PlayerSettings, if so, maybe they’re invalid. Does the same happen with empty project, if no, you might need to regenerate your templates.

Thanks for your reply, yes I get the same issue in a new project without any custom gradle templates. That’s what making this harder.

Did you by chance overrode JDK/SDK/NDK/Gradle paths in Preferences->External Tools?

Can you share complete error log?

Hi,

I’m having the same issue since updating to Unity 2022.3.12 LTS. Android builds would work fine in previous Unity (2021.3.16 LTS), but now I get about 50% rate on it failing with this error:

Currently my only workaround is to revert any changes to ProjectSettings.asset and GvhProjectSettings.xml, restart the Editor, close other applications that might be reading files (eg: Rider, Plastic), and then try again. Not always, but it can work after a few tries of this.

Attached is my External Tools settings for reference, which looks like it’s changed to whatever comes with Unity 2022.3.12 LTS.

Any help here greatly appreciated. I’m not good on Android specific stuff (I rely heavily on Unity doing this heavy lifting for me!), and Google shows only this page as a promising result…

Regards,
Justin

Apologies for the late reply.

No, I’m using the built-in paths.

Yes, I have it attached. The error is on line 676.

I haven’t come any closer to figuring out this issue since the original post.

9494965–1336921–Editor.txt (231 KB)

I do get this error as well though, so I’ll try with a custom SDK install
Exception while marshalling \AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only

Your error is:

* What went wrong:
Execution failed for task ':launcher:lintVitalAnalyzeRelease'.
> A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

Sadly, I don’t know, why you’re getting this issue

You have two options to try

  1. Run Unity Editor as administrator and try building or
  2. Delete AndroidPlayer\SDK\build-tools\32.0.0 and AndroidPlayer\SDK\platforms\android-33 and reinstall by setting target api as api 34/33 or those folders from Android studio installed android sdk.

I also have this error message. My solution is go to \AndroidPlayer\SDK and change the user permissions for my user account.