androidfirebaseunity-game-enginefirebase-storageexternal-dependencies

Gradle failed to fetch dependencies for Unity Mediation, Firebase, and Google Play Service


I am not able to force resolve this issue. Until a few days back it was working fine. I assume after installing a package from Unity Mediation made this all issues. After which, I removed that package and still this error isn't solved.

[Log] Reading Android dependency XML file Assets/Editor/MediationAdapterDependencies.xml
[Log] DependOn - group: com.unity3d.mediation artifact: mediation-sdk version: [0.2,0.3[ classifier: null packageIds:  repositories:
[Log] DependOn - group: com.unity3d.mediation artifact: admob-adapter version: [0.2,0.3[ classifier: null packageIds:  repositories:
[Log] DependOn - group: com.unity3d.mediation artifact: unityads-adapter version: [0.2,0.3[ classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.firebase artifact: firebase-common version: 20.0.0 classifier: null packageIds:  repositories:
[Log] (4) DependOn - group: com.google.firebase artifact: firebase-analytics version: 19.0.0 classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.android.gms artifact: play-services-base version: 17.6.0 classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.firebase artifact: firebase-auth version: 21.0.1 classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.firebase artifact: firebase-messaging version: 22.0.0 classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.firebase artifact: firebase-iid version: 21.1.0 classifier: null packageIds:  repositories:
[Log] DependOn - group: com.google.firebase artifact: firebase-storage version: 20.0.0 classifier: null packageIds:  repositories:
[Log] Reading Android dependency XML file Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml
[Log] DependOn - group: com.google.games artifact: gpgs-plugin-support version: 0.10.12 classifier: null packageIds:  repositories: Assets/GooglePlayGames/Editor/m2repository

Resolution failed
Failed to fetch the following dependencies:
com.unity3d.mediation:mediation-sdk:[0.2,0.3[
com.unity3d.mediation:admob-adapter:[0.2,0.3[
com.unity3d.mediation:unityads-adapter:[0.2,0.3[
com.google.firebase:firebase-common:20.0.0
com.google.firebase:firebase-analytics:19.0.0
com.google.android.gms:play-services-base:17.6.0
com.google.firebase:firebase-app-unity:8.4.0
com.google.firebase:firebase-auth:21.0.1
com.google.firebase:firebase-auth-unity:8.4.0
com.google.firebase:firebase-messaging:22.0.0
com.google.firebase:firebase-iid:21.1.0
com.google.firebase:firebase-messaging-unity:8.4.0
com.google.firebase:firebase-storage:20.0.0
com.google.firebase:firebase-storage-unity:8.4.0
com.google.games:gpgs-plugin-support:0.10.12

[Log] Missing Android component com.unity3d.mediation:mediation-sdk:[0.2,0.3[ (Android SDK Packages: )
[Log] Missing Android component com.unity3d.mediation:admob-adapter:[0.2,0.3[ (Android SDK Packages: )
[Log] Missing Android component com.unity3d.mediation:unityads-adapter:[0.2,0.3[ (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-common:20.0.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-analytics:19.0.0 (Android SDK Packages: )
[Log] Missing Android component com.google.android.gms:play-services-base:17.6.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-app-unity:8.4.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-auth:21.0.1 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-auth-unity:8.4.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-messaging:22.0.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-iid:21.1.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-messaging-unity:8.4.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-storage:20.0.0 (Android SDK Packages: )
[Log] Missing Android component com.google.firebase:firebase-storage-unity:8.4.0 (Android SDK Packages: )
[Log] Missing Android component com.google.games:gpgs-plugin-support:0.10.12 (Android SDK Packages: )

Even I tried to reimport all those packages once again. Still, the issue persists.


Solution

    1. In the Unity Editor, open your project and go to Project Settings > Player > Publish Settings > Custom Main Gradle Template and ensure the Custom Main Gradle Template checkbox is enabled.
    2. Then, go to the Project tab and navigate to Assets > PlayServicesResolver > Android Resolver > Force Resolve.
    3. Now try to build the project. (With these settings, Android dependencies will not be included directly in the project anymore)

    This will resolve all the dependencies. In case if you have trouble while taking build (Gradel Build). Go to Project Settings > Player > Publishing Settings and select the Custom Gradle Properties Template checkbox. Then Navigate to the path below the checkbox and add these two lines to the end of the file:

    android.useAndroidX=true
    android.enableJetifier=true
    

    And then take a build. hope it works.