androidfirebaseunity-game-enginebuildandroid-gradle-plugin

How can I solve this Build error in Unity after adding Firebase to the project?


I want to add Firebase to my Unity project. I followed the Firebase docs from here: https://firebase.google.com/docs/unity/setup-alternative#alternative_unity_package_manager. I imported External Dependency Manager first, and no problem. I got the .tgz files from here (as it says in the docs) https://developers.google.com/unity/archive. However, after importing Firebase Core (com.google.firebase.app), when I build for android I get the following error:

Build Failure

In the console, I see the following:

Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details

> Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:FirebaseApp.androidlib:compileReleaseAidl NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:FirebaseApp.androidlib:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:FirebaseApp.androidlib:packageReleaseResources UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE

> Task :unityLibrary:processReleaseManifest FAILED

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


> Task :launcher:mergeReleaseResources
11 actionable tasks: 2 executed, 9 up-to-date

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

I've been trying to figure out what is causing the error, but I don't understand. As far as I can tell, my Gradle version is up to date. Is it the fact that some of the scripts listed in the console are NO-SOURCE?

I also tried downloading the Firebase SDK and importing the Unity packages I want, and I get the same exact error.


Solution

  • A very helpful Firebase rep helped me solve this. The solution is to set the Minimum API Level to 31 (in Player Settings), build and download SDK when prompted, then set the Minimum API Level back to a lower API level if need be. You may need to restart Unity before changing the API level back down.

    After this the error is gone.