이 페이지에서는 Firebase 사용 시 발생할 수 있는 Unity 관련 문제의 팁과 문제 해결 방법을 제공합니다.
아래에서 찾을 수 없는 다른 문제나 어려운 점이 있으신가요? Firebase 전체 FAQ 또는 제품별 FAQ를 살펴보려면 기본 Firebase FAQ를 확인하세요.
Android 앱 빌드 도중 단일 dex 관련 문제
Android 앱을 빌드하는 동안 단일 dex 파일 보유와 관련된 빌드 실패가 발생할 수 있습니다. 프로젝트가 Gradle 빌드 시스템을 사용하도록 구성된 경우 오류 메시지는 다음과 유사합니다.
Cannot fit requested classes in a single dex file.
Dalvik 실행 파일(.dex)은 Android 애플리케이션(.apk)의 클래스 정의 및 관련 부속 데이터를 저장하는 데 사용됩니다. 단일 dex 파일은 65,536개의 메서드를 참조하도록 제한됩니다. 프로젝트의 모든 Android 라이브러리에 있는 총 메서드 개수가 이 한도를 초과하면 빌드가 실패합니다.
Unity는 2017.2 버전에 Minification(축소) 기능을 도입했습니다. 이는 Proguard(또는 Unity 일부 버전의 다른 도구)를 사용하여 사용하지 않는 코드를 제거하는 기능으로 단일 dex 파일에 참조된 메서드의 총 개수를 줄일 수 있습니다. 이 옵션은 Player Settings(플레이어 설정) > Android > Publishing Settings(게시 설정) > Minify(축소)에서 찾을 수 있습니다. 옵션은 Unity 버전마다 다를 수 있으므로 공식 Unity 문서를 참조하세요.
참조된 메서드의 개수가 여전히 한도를 초과하는 경우 또 다른 옵션은 multidex를 사용 설정하는 것입니다. Unity에서 이를 수행하는 방법에는 여러 가지가 있습니다.
Player Settings 아래의 Custom Gradle Template이 사용 설정되어 있으면 mainTemplate.gradle을 수정합니다.
Android 스튜디오를 사용하여 내보낸 프로젝트를 빌드하는 경우 모듈 수준 build.gradle 파일을 수정합니다.
Android용으로 빌드할 때 minSdkVersion 23을 타겟팅하면 덱싱 단계(일반적으로 Gradle 작업 ':launcher:mergeExtDexDebug')에서 실패할 수 있으며, 이 경우 Android 라이브러리 중 하나를 '변환하지 못했습니다'라는 메시지가 표시됩니다. 이는 대부분의 Unity 편집기에서 사용하는 Android SDK의 기본 dex 도구에 있는 버그로 인해 발생하며 다음과 같은 여러 가지 방법으로 수정할 수 있습니다.
minSdkVersion을 24로 설정합니다.
Player Settings(플레이어 설정) > Android > Publishing Settings(게시 설정) > Minify(축소)에서 Android 축소를 사용 설정합니다.
다음을 settingsTemplate.gradle 파일에 추가하여 다른 버전의 dex 도구를 지정합니다.
[null,null,["최종 업데이트: 2025-08-12(UTC)"],[],[],null,["\u003cbr /\u003e\n\nThis page offers tips and troubleshooting for Unity-specific issues\nthat you might encounter when using Firebase.\n\nHave other challenges or don't see your issue outlined below? Make sure to check\nout the [main Firebase FAQ](/support/faq) for more pan-Firebase or\nproduct-specific FAQ.\n\nAn issue with single dex while building Android app\n\nWhile building Android app, you may encounter a build failure related to having\na single dex file. The error message looks similar to the following, if your\nproject is configured to use the Gradle build system. \n\n Cannot fit requested classes in a single dex file.\n\nDalvik Executable (`.dex`) files are used to hold a set of class definitions\nand their associated adjunct data for Android applications (`.apk`). A single dex\nfile is limited to reference to 65,536 methods. The build will fail if the total\nnumber of methods from all Android libraries in your project exceeds this limit.\n\nUnity introduced [Minification](https://docs.unity3d.com/2017.2/Documentation/Manual/android-gradle-overview.html)\nin 2017.2, which uses Proguard (or other tools in some versions of Unity)\nto strip out unused code, which can reduce the total number of\nreferenced methods in a single dex file. The option can be found in\n**Player Settings \\\u003e Android \\\u003e Publishing Settings \\\u003e Minify**. The options may\ndiffer in different version of Unity so refer to the official Unity\ndocumentation.\n\nIf the number of referenced methods still exceeds the limit, another option is\nto enable `multidex`. There are multiple ways to achieve this in Unity:\n\n- If `Custom Gradle Template` under `Player Settings` is enabled, modify `mainTemplate.gradle`.\n- If you use Android Studio to build the exported project, modify module-level `build.gradle` file.\n\nMore details can be found in [the multidex user guide](https://developer.android.com/studio/build/multidex).\n\nIssues when building for Android with minSdkVersion 23\n\nWhen building for Android, if you target `minSdkVersion` 23, it might fail on\nthe dexing step, usually in the Gradle task ':launcher:mergeExtDexDebug', where\nit will say it \"Failed to transform\" one of the Android libraries. This is\ncaused because of a bug in the default dex tool in the Android SDK that most\nUnity editors use, and can be fixed in a few different ways:\n\n- Set the `minSdkVersion` to 24.\n- Turn on Android minification, in **Player Settings \\\u003e Android \\\u003e Publishing Settings \\\u003e Minify**\n- Specify a different version of the dex tool by adding this to your `settingsTemplate.gradle` file:\n\n buildscript {\n repositories {\n mavenLocal()\n maven { url 'https://maven.google.com' }\n mavenCentral()\n }\n dependencies {\n classpath 'com.android.tools:r8:8.3.37'\n }\n }\n\nIssues when building for iOS with Cocoapods\n\nWhen building for iOS, Cocoapod installation may fail with an error about the\nlanguage locale, or UTF-8 encoding. There are currently several different ways\nto work around the issue.\n\n- From the terminal, run `pod install` directly, and open the resulting\n xcworkspace file.\n\n- Downgrade the version of Cocoapods to 1.10.2. The issue exists only in\n version 1.11 and newer.\n\n- In your `~/.bash_profile` or equivalent, add `export LANG=en_US.UTF-8`\n\nHow to update the version of Firebase Unity SDKs\n\nThe process to update the versions of Firebase Unity SDKs depends on how they\nwere initially imported. Here are the two alternative import methods:\n\n- Importing `.unitypackage` files under your project's `Assets/` directory\n- Importing using the [Unity Package Manager](https://docs.unity3d.com/Manual/Packages.html) (UPM)\n - This is the recommended way to manage packages in Unity 2018.4+.\n - Use this method to make future version updates easier and your `Assets/` directory cleaner.\n\nIn your Unity project, you should only use one import method to manage all your\nFirebase packages. The instructions below can be used to not only update the\nversion of individual packages, but also, if needed, to migrate package\nmanagement to UPM (the recommended import method).\n| **Note:** Before updating the SDK version, manually create a local backup. Afterward, if the project fails to build or run properly in the editor or on target platforms, you can restore from the backup.\n\n\u003cbr /\u003e\n\nPackages imported as `.unitypackage` files into the\n`Assets/` directory\n\n\u003cbr /\u003e\n\nIf Firebase packages are in the `Assets/` directory, you have two options for\nupdating the SDK version:\n\n- *Option 1 *(recommended)**: Migrate to use UPM (available in Unity 2018.4+)\n\n - Follow the Firebase-provided [instructions to migrate package management\n to UPM](/docs/unity/setup-alternative#alternative_migrate_to_upm).\n - While this method requires more initial setup than continuing to use the `.unitypackage` workflow, it pays off in ease of subsequent SDK version updates.\n- *Option 2* : Continue to use `.unitypackage` files to import them into the\n `Assets/` directory\n\n 1. Import\n [each of the packages](/docs/unity/setup-alternative#alternative_individual_unitypackages)\n for the updated version.\n\n If you download [firebase_unity_sdk.zip](/docs/unity/setup) from the\n Firebase website, make sure that you import all `.unitypackages` from\n the correct `dotnet` folder.\n - If you're using Unity 2019 or later, import from the `dotnet4` folder.\n - Otherwise, select *Scripting Runtime Version* in *Player Settings* , and if it's set to \".NET 3.x\", import from the `dotnet3` folder.\n 2. Overwriting of the previously imported package versions should be\n handled automatically by the External Dependency Manager (which is\n automatically included when you import the Firebase `.unitypackages`).\n\n However, if and ONLY if this automatic process fails, you'll need to\n manually delete the following folders and then re-try the above import\n step again.\n - `Assets/Editor Default Resources/Firebase`\n - `Assets/ExternalDependencyManager`\n - `Assets/Firebase`\n - `Assets/Parse`\n - `Assets/Plugins/iOS/Firebase`\n\n\u003cbr /\u003e\n\nPackages managed by UPM\n\n\u003cbr /\u003e\n\nIf Firebase packages are managed by UPM,\n[import the newer SDK version as a `.tgz`](/docs/unity/setup-alternative#alternative_unity_package_manager).\nThis import will automatically overwrite the previous version.\n| **Note:** Make sure to upgrade ALL Firebase Unity packages and their dependencies (including `com.google.firebase.app`) to the same version. The only exception is the dependency on the External Dependency Manager, which should be updated to the [`com.google.external-dependency-manager` version](https://developers.google.com/unity/archive#firebase_app_core) that corresponds to the updated version of your Firebase Unity packages."]]