Search Unity

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

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

  1. AndreaMar

    AndreaMar

    Joined:
    Oct 29, 2019
    Posts:
    35
    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

    AndreaMar

    Joined:
    Oct 29, 2019
    Posts:
    35
    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(java.io.File 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

    Kurt-Dekker

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

    https://forum.unity.com/threads/cant-build-for-android.1306098/

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

    https://forum.unity.com/threads/aab...y-2021-3-8-with-jdk-1-8.1322211/#post-8551193

    Android Gradle errors and other related stuff:

    https://forum.unity.com/threads/unity-gradle-bug-please-help.1368018/#post-8625789
    Extra unwanted packages in new projects (collab, testing, rider and other junk):

    https://forum.unity.com/threads/temp-unityengine-testrunner-dll-error.1133938/#post-7287748

    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:

    https://stackoverflow.com/questions/53145919/unity3d-package-cache-errors/69779122
     
    AndreaMar likes this.
  4. AndreaMar

    AndreaMar

    Joined:
    Oct 29, 2019
    Posts:
    35
    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.