Version Conflicts between Firebase Analytics Unity Package and the Google Mobile Ads Unity Package.

983 views
Skip to first unread message

Jamie Corkhill

unread,
Nov 4, 2018, 9:22:45 AM11/4/18
to Firebase Google Group
Hello. I posted this on the Google Mobile Ads SDK Google Group, but I wanted to post it here as well for it also concerns Firebase Analytics, and may be helpful for someone in the future.

I have been attempting to implement the latest version of Google Analytics for Firebase, version 5.4.0, as well as the Google Mobile Ads SDK, version 3.15.1, in my Unity Project, with an Android Build Target.

Even after updating the Android Play Services Resolver plugin to its latest version, 1.2.95.0, I still receive the following warning in the Unity Console:

Some conflicting dependencies were found.
The following dependency versions were modified:
com.google.android.gms:play-services-ads:15.0.1 --> com.google.android.gms:play-services-ads:+
com.google.firebase:firebase-analytics:16.0.4 --> com.google.firebase:firebase-analytics:+
com.google.firebase:firebase-common:16.0.3 --> com.google.firebase:firebase-common:+
com.google.firebase:firebase-core:16.0.4 --> com.google.firebase:firebase-core:+

Additionally, when trying to build the APK for Android, I receive the following error:

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_161\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformDexWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/measurement/zzdz;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 32s
]
stdout[
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
:preBuild UP-TO-DATE
:Firebase:preBuild UP-TO-DATE
:Firebase:preReleaseBuild UP-TO-DATE
:Firebase:checkReleaseManifest
:Firebase:processReleaseManifest
:GoogleMobileAdsPlugin:preBuild UP-TO-DATE
:GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE
:GoogleMobileAdsPlugin:checkReleaseManifest
:GoogleMobileAdsPlugin:processReleaseManifest
:preReleaseBuild
:Firebase:compileReleaseAidl
:GoogleMobileAdsPlugin:compileReleaseAidl
:compileReleaseAidl
:Firebase:packageReleaseRenderscript NO-SOURCE
:GoogleMobileAdsPlugin:packageReleaseRenderscript NO-SOURCE
:compileReleaseRenderscript
:checkReleaseManifest
:generateReleaseBuildConfig
:prepareLintJar
:generateReleaseResValues
:generateReleaseResources
:Firebase:compileReleaseRenderscript
:Firebase:generateReleaseResValues
:Firebase:generateReleaseResources
:Firebase:packageReleaseResources
:GoogleMobileAdsPlugin:compileReleaseRenderscript
:GoogleMobileAdsPlugin:generateReleaseResValues
:GoogleMobileAdsPlugin:generateReleaseResources
:GoogleMobileAdsPlugin:packageReleaseResources
:mergeReleaseResources
:createReleaseCompatibleScreenManifests
:processReleaseManifest
:splitsDiscoveryTaskRelease
:Firebase:platformAttrExtractor
:GoogleMobileAdsPlugin:platformAttrExtractor
:Firebase:generateReleaseBuildConfig
:Firebase:prepareLintJar
:Firebase:javaPreCompileRelease
:Firebase:processReleaseJavaRes NO-SOURCE
:GoogleMobileAdsPlugin:generateReleaseBuildConfig
:GoogleMobileAdsPlugin:prepareLintJar
:GoogleMobileAdsPlugin:javaPreCompileRelease
:GoogleMobileAdsPlugin:processReleaseJavaRes NO-SOURCE
:compileReleaseNdk NO-SOURCE
:mergeReleaseShaders
:compileReleaseShaders
:generateReleaseAssets
:Firebase:mergeReleaseShaders
:Firebase:compileReleaseShaders
:Firebase:generateReleaseAssets
:Firebase:mergeReleaseAssets
:GoogleMobileAdsPlugin:mergeReleaseShaders
:GoogleMobileAdsPlugin:compileReleaseShaders
:GoogleMobileAdsPlugin:generateReleaseAssets
:GoogleMobileAdsPlugin:mergeReleaseAssets
:mergeReleaseAssets
:mergeReleaseJniLibFolders
:Firebase:compileReleaseNdk NO-SOURCE
:Firebase:mergeReleaseJniLibFolders
:Firebase:transformNativeLibsWithMergeJniLibsForRelease
:Firebase:transformNativeLibsWithIntermediateJniLibsForRelease
:GoogleMobileAdsPlugin:compileReleaseNdk NO-SOURCE
:GoogleMobileAdsPlugin:mergeReleaseJniLibFolders
:GoogleMobileAdsPlugin:transformNativeLibsWithMergeJniLibsForRelease
:GoogleMobileAdsPlugin:transformNativeLibsWithIntermediateJniLibsForRelease
:processReleaseJavaRes NO-SOURCE
:validateSigningRelease
:Firebase:mergeReleaseConsumerProguardFiles
:Firebase:transformNativeLibsWithSyncJniLibsForRelease
:Firebase:mergeReleaseResources
:Firebase:verifyReleaseResources
:GoogleMobileAdsPlugin:mergeReleaseConsumerProguardFiles
:GoogleMobileAdsPlugin:transformNativeLibsWithSyncJniLibsForRelease
:GoogleMobileAdsPlugin:mergeReleaseResources
:GoogleMobileAdsPlugin:verifyReleaseResources
:GoogleMobileAdsPlugin:processReleaseResources
:GoogleMobileAdsPlugin:generateReleaseSources
:GoogleMobileAdsPlugin:compileReleaseJavaWithJavac
:GoogleMobileAdsPlugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:GoogleMobileAdsPlugin:extractReleaseAnnotations
:GoogleMobileAdsPlugin:transformResourcesWithMergeJavaResForRelease
:GoogleMobileAdsPlugin:transformClassesAndResourcesWithSyncLibJarsForRelease
:GoogleMobileAdsPlugin:bundleRelease
:GoogleMobileAdsPlugin:compileReleaseSources
:GoogleMobileAdsPlugin:assembleRelease
:Firebase:processReleaseResources
:processReleaseResources
:generateReleaseSources
:Firebase:generateReleaseSources
:Firebase:compileReleaseJavaWithJavac
:Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:javaPreCompileRelease
:compileReleaseJavaWithJavac
:compileReleaseSources
:lintVitalRelease
:transformClassesWithPreDexForRelease
:transformDexWithDexForRelease FAILED
72 actionable tasks: 72 executed
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <fdd3823527dc4dde8316302bb5a76d3b>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()


The main problem is:

java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/measurement/zzdz;


Any help would be much appreciated.

Thank you,
Jamie

Anthony Maurice

unread,
Nov 7, 2018, 5:35:38 PM11/7/18
to fireba...@googlegroups.com
Hi Jamie,

Sorry for the delay in getting back to you.  A real fix for this issue is in the works, but as a workaround for the time being, you can edit Assets/Firebase/Editor/AnalyticsDependencies.xml, adding in:

    <androidPackage spec="com.google.android.gms:play-services-measurement-sdk-api:16.0.3">
    </androidPackage>  


along side the other androidPackages listed in there.  You'll still see that warning, but you should be able to build with that.

We'll update this when a proper fix is made available.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/58eb0aed-ad73-42b8-910d-1542650355ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jamie Corkhill

unread,
Nov 7, 2018, 7:44:31 PM11/7/18
to Firebase Google Group
Anthony,

Thank you. That works now. I appreciate your help.

Umair Hafeez

unread,
Nov 9, 2018, 9:55:36 AM11/9/18
to Firebase Google Group
hi Anthony

i also face a same problem. I have been attempting to implement the latest version of Google Analytics for Firebase, version 5.4.1/dotnet 4, as well as the Google Mobile Ads SDK, version 3.15.1, in my Unity Project, with an Android Build Target.i edit the  Assets/Firebase/Editor/AnalyticsDependencies.xml, according your instruction after that my application crash.

Any help would be much appreciated.

Thank you,

Jamie Corkhill

unread,
Nov 9, 2018, 5:34:45 PM11/9/18
to fireba...@googlegroups.com
Umair, 

Could you provide an error message or log so that I or Anthony can better assist you?

Thanks,
Jamie

Anthony Maurice

unread,
Nov 12, 2018, 6:29:40 PM11/12/18
to Firebase Google Group
Hi Umair,

It seems like there is some issue with the interaction between Firebase Analytics and the Google Mobiles Ads SDK.  We are still trying to get a proper fix for it, but from https://github.com/firebase/quickstart-unity/issues/241, some other users have found that using release 5.3.1 has worked for them, which you can get via https://dl.google.com/firebase/sdk/unity/firebase_unity_sdk_5.3.1.zip

We are working on an update that will have the proper fix, but in the meantime that might work for you.

Umair Hafeez

unread,
Nov 13, 2018, 10:12:24 AM11/13/18
to fireba...@googlegroups.com
Hi Anthony,

Thank you. That works now. I appreciate your help.
Reply all
Reply to author
Forward
0 new messages