Problems building Android apk Unity 2022.3.45f1

Hi there,

I’m trying to build my project for Android. At first using 2022.3.44fx. I get the error messages shown below. After reading some posts I upgraded tot 2022.3.45f1, but unfortunately this doesn’t help.

Anyone got a suggestion how I can fix this? I’m usually developing for PCVR, pretty new to Android platform. So maybe I’m missing something in the settings?

Configure project :launcher
WARNING:The option setting ‘android.aapt2FromMavenOverride=C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\34.0.0\aapt2.exe’ is experimental.
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 35

This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33

This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=35
to this project’s gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 35
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\34.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-34\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\34.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-34\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.45f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only

Task :launcher:preBuild UP-TO-DATE
Task :unityLibrary:preBuild UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:preBuild UP-TO-DATE
Task :launcher:preReleaseBuild UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:preReleaseBuild UP-TO-DATE
Task :unityLibrary:preReleaseBuild UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:compileReleaseAidl NO-SOURCE
Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:compileReleaseAidl NO-SOURCE
Task :launcher:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:compileReleaseRenderscript NO-SOURCE
Task :launcher:compileReleaseAidl NO-SOURCE
Task :unityLibrary:mobilenotifications.androidlib:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:generateReleaseResources UP-TO-DATE
Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
Task :launcher:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:packageReleaseResources UP-TO-DATE
Task :launcher:generateReleaseResValues UP-TO-DATE
Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
Task :launcher:extractProguardFiles UP-TO-DATE
Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:parseReleaseLocalResources UP-TO-DATE
Task :unityLibrary:mobilenotifications.androidlib:processReleaseManifest UP-TO-DATE
Task :launcher:checkReleaseDuplicateClasses FAILED
Task :unityLibrary:copyReleaseJniLibsProjectAndLocalJars
Task :unityLibrary:mobilenotifications.androidlib:generateReleaseRFile
16 actionable tasks: 3 executed, 13 up-to-date

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Cheers!
-Bender

Share full error log, please

First issue looks solved. Here full error where things go wrong:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ‘:launcher:checkReleaseDuplicateClasses’.

Could not resolve all files for configuration ‘:launcher:releaseRuntimeClasspath’.
Failed to transform support-v4-25.1.0-.aar (:support-v4-25.1.0:) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.status=integration, org.gradle.usage=java-runtime}.
Execution failed for JetifyTransform: D:\Unity\LocationBasedTest02\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\libs\support-v4-25.1.0.aar.
Failed to transform ‘D:\Unity\LocationBasedTest02\Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\libs\support-v4-25.1.0.aar’ using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference ‘android.support.v4’ that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx… (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won’t be able to jetify this library.
Suggestions:
- If you believe this library doesn’t need to be jetified (e.g., if it already supports AndroidX, or if it doesn’t use support libraries/AndroidX at all), add android.jetifier.ignorelist = {comma-separated list of regular expressions (or simply names) of the libraries that you don’t want to be jetified} to the gradle.properties file.
- If you believe this library needs to be jetified (e.g., if it uses old support libraries and breaks your app if it isn’t jetified), contact the library’s authors to update this library to support AndroidX and use the supported version once it is released.
If you need further help, please leave a comment at Google Issue Tracker.

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • 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.
==============================================================================

BUILD FAILED in 2s

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I haven’t seen such before. I could try looking into if you would share a minimal repro project

Thanks for your help. I tried stripping some assets from my project and it looks like an empty project is building well. So must be in some outdated package. So, for now I’ll close this topic.