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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Bug Please, help me get over this Android build errors.

Discussion in 'Editor & General Support' started by AndreaMar, Jan 26, 2023.

  1. AndreaMar


    Oct 29, 2019
    I've lost a lot of time trying to resolve this issue. I've just upgraded (downgraded?) from Unity 2022.something to Unity 2021.3.16f1 on the suggestion of the Unity Hub. Good, the latter one is made for Silicon chips and I'm using a M1 Mac.

    I'm using UnityAds/IronSource (mediating with Google Admob) and some Unity Game Services like UnityCloudSave and Authentication. I have Java JRE (Java(TM) SE Runtime Environment (build 1.8.0_361-b09), OpenJDK (Java JDK installed with Unity is 1.8.0_152), Android SDK & NDK tools. I'm using the Android Mobile Dependencies Resolver.

    I'm trying to build for Android and I get these errors while building. I've already tried everything it's said here, but with no results.

    Attached Files:

    Last edited: Jan 26, 2023
  2. AndreaMar


    Oct 29, 2019
    I've upgraded Gradle to the last version.

    Debug log is slightly different now. It seems to be an IronSource package issue.

    * What went wrong:
    Execution failed for task ':unityLibrary:IronSource.plugin:compileDebugJavaWithJavac'.
    > Failed to calculate the value of task ':unityLibrary:IronSource.plugin:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
    > Querying the mapped value of map( property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/andreamarchetti/Desktop/Chicken Family/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/IronSource.plugin/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@44eacff8) before task ':unityLibrary:IronSource.plugin:compileDebugJavaWithJavac' has completed is not supported
  3. Kurt-Dekker


    Mar 16, 2013
    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.

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

    Android Gradle errors and other related stuff:
    Extra unwanted packages in new projects (collab, testing, rider and other junk):

    About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.

    Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:
    AndreaMar likes this.
  4. AndreaMar


    Oct 29, 2019
    Thanks Kurt for your reply. Next time I'll be more systematic.

    I've finally figured it out, but by trials and errors. It was a duplicate dependency caused by having both :confused: Unity Ads and IronSource (which is Ads Mediation in the Package Manager) packages installed. I forgot I had installed UnityAds once :oops:.
    Kurt-Dekker likes this.