Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Unity Build Errors for iOS and Android

Discussion in 'Editor & General Support' started by shalika_mendis, Jun 13, 2023.

  1. shalika_mendis

    shalika_mendis

    Joined:
    Sep 25, 2020
    Posts:
    2
    Hi,

    We are working on a game project in Unity, targeting iOS and Android platforms. However, we've been encountering intermittent build errors during development. We have tried troubleshooting steps, verified project settings, and checked dependencies, but the issues persist.

    If anyone has faced similar problems or has suggestions, we would greatly appreciate your input. Are there common pitfalls or best practices for building in Unity for iOS and Android? Any insights or guidance to resolve these errors would be valuable.

    Your support in troubleshooting these build errors would be immensely helpful. Thank you!

    Best regards,
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    The complete error message contains everything you need to know to fix the error yourself.

    The important parts of the error message are:

    - the description of the error itself (google this; you are NEVER the first one!)
    - the file it occurred in (critical!)
    - the line number and character position (the two numbers in parentheses)
    - also possibly useful is the stack trace (all the lines of text in the lower console window)

    Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

    Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly?

    All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don't have to stop your progress and fiddle around with the forum.

    Remember: NOBODY here memorizes error codes. That's not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

    ----------------------

    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
     
    shalika_mendis likes this.
  3. shalika_mendis

    shalika_mendis

    Joined:
    Sep 25, 2020
    Posts:
    2
    Thank you for sharing your knowledge and assisting in the Unity community. Your contributions are valuable and appreciated.
     
    Kurt-Dekker likes this.
  4. unity_2XcYXkRGJoGIlA

    unity_2XcYXkRGJoGIlA

    Joined:
    Jul 4, 2022
    Posts:
    5
    Many have problems assigning Google Admob, the solution is very simple.
    When you generate the cocoapods internally in the mac terminal.
    1- Drag the .xcodeproj file to the terminal, DO NOT DRAG the project folder, just drag that file

    2- Hit enter

    3- Write pod install

    Ready, your game is out.