Search Unity

Google Firebase...

Discussion in 'External Tools' started by Zelre, Sep 14, 2019.

  1. Zelre

    Zelre

    Joined:
    Dec 3, 2016
    Posts:
    55
    Hi guys,

    Trying to figure out Firebase again, but their documentation is confusing...

    All I need is Google Login, Facebook Login, Twitter Login and sending/receiving data from their Firestore database. Also, is there an easier way to associate user data to a userid directly inside their database?

    Would really appreciate it if there's anyone out there that has gotten the above things working that could share the code they used... Even if you've just got the code for 1 of them.

    Kind regards,
    Michael.

    Edit: I'm also getting a build error when trying to build an Android project with with ALL of the Firebase tools imported..

    Error #1:
    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    3.  
    4. stderr[
    5. D8: Type com.google.firebase.iid.zzap is referenced as an interface from `com.google.firebase.iid.zzj`.
    6. com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Michael Joubert\.gradle\caches\transforms-1\files-1.1\com.google.firebase.firebase-iid-20.0.0.aar\c05e5d942fa54af238714596dc9c3626\jars\classes.jar
    7.     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    8.     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    9.     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    10.     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    11.     at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    12.     at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    13.     at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
    14.     at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
    15.     at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:405)
    16.     at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
    17.     at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
    18.     at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    19.     at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
    20.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    21.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    22.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    23.     at java.lang.reflect.Method.invoke(Method.java:498)
    24.     at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    25.     at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    26.     at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    27.     at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    28.     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
    29.     at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    30.     at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    31.     at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    32.     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    33.     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
    34.     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
    35.     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
    36.     at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    37.     at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    38.     at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    39.     at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    40.     at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    41.     at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    42.     at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    43.     at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    44.     at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    45.     at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    46.     at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    47.     at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    48.     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
    49.     at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    50.     at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    51.     at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    52.     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    53.     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
    54.     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
    55.     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    56.     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    57.     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    58.     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    59.     at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
    60.     at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
    61.     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    62.     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    63.     at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    64.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    65.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    66.     at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    67.     at java.lang.Thread.run(Thread.java:748)
    68. Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Michael Joubert\.gradle\caches\transforms-1\files-1.1\com.google.firebase.firebase-iid-20.0.0.aar\c05e5d942fa54af238714596dc9c3626\jars\classes.jar
    69.     at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:900)
    70.     at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$6(DexArchiveBuilderTransform.java:825)
    71.     at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
    72.     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    73.     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    74.     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    75.     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    76. Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
    77.     at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:124)
    78.     at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:101)
    79.     at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:895)
    80.     ... 6 more
    81. Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    82.     at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:65)
    83.     at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:43)
    84.     at com.android.tools.r8.D8.run(D8.java:90)
    85.     at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:99)
    86.     ... 7 more
    87. Caused by: com.android.tools.r8.utils.AbortException: Error: Type com.google.firebase.iid.zzap is referenced as an interface from `com.google.firebase.iid.zzj`.
    88.     at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:116)
    89.     at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:74)
    90.     at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:59)
    91.     ... 10 more
    92.  
    93.  
    94. FAILURE: Build failed with an exception.
    95.  
    96. * What went wrong:
    97. Execution failed for task ':transformClassesWithDexBuilderForRelease'.
    98. > com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Michael Joubert\.gradle\caches\transforms-1\files-1.1\com.google.firebase.firebase-iid-20.0.0.aar\c05e5d942fa54af238714596dc9c3626\jars\classes.jar
    99.  
    100. * Try:
    101. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    102.  
    103. * Get more help at https://help.gradle.org
    104.  
    105. BUILD FAILED in 6m 41s
    106. ]
    107. stdout[
    108. :checkReleaseClasspath
    109. :preBuild UP-TO-DATE
    110. :Firebase:preBuild UP-TO-DATE
    111. :Firebase:preReleaseBuild UP-TO-DATE
    112. :Firebase:checkReleaseManifest
    113. :Firebase:processReleaseManifest
    114. :preReleaseBuild
    115. :Firebase:compileReleaseAidl NO-SOURCE
    116. :compileReleaseAidl NO-SOURCE
    117. :Firebase:packageReleaseRenderscript NO-SOURCE
    118. :compileReleaseRenderscript
    119. :checkReleaseManifest UP-TO-DATE
    120. :generateReleaseBuildConfig UP-TO-DATE
    121. :prepareLintJar UP-TO-DATE
    122. :mainApkListPersistenceRelease UP-TO-DATE
    123. :generateReleaseResValues UP-TO-DATE
    124. :generateReleaseResources
    125. :Firebase:compileReleaseRenderscript
    126. :Firebase:generateReleaseResValues
    127. :Firebase:generateReleaseResources
    128. :Firebase:packageReleaseResources
    129. :mergeReleaseResources
    130. :createReleaseCompatibleScreenManifests UP-TO-DATE
    131. :processReleaseManifest
    132. C:\Users\Michael Joubert\Documents\Necrorok\Temp\gradleOut\src\main\AndroidManifest.xml:24:9-31:50 Warning:
    133.     activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present
    134. :splitsDiscoveryTaskRelease UP-TO-DATE
    135. :Firebase:generateReleaseRFile
    136. :processReleaseResources
    137. :generateReleaseSources
    138. :Firebase:generateReleaseBuildConfig
    139. :Firebase:prepareLintJar UP-TO-DATE
    140. :Firebase:generateReleaseSources
    141. :Firebase:javaPreCompileRelease
    142. :Firebase:compileReleaseJavaWithJavac
    143. :Firebase:processReleaseJavaRes NO-SOURCE
    144. :Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    145. :javaPreCompileRelease
    146. :compileReleaseJavaWithJavac
    147. :compileReleaseNdk NO-SOURCE
    148. :compileReleaseSources
    149. :lintVitalRelease
    150. :mergeReleaseShaders UP-TO-DATE
    151. :compileReleaseShaders UP-TO-DATE
    152. :generateReleaseAssets UP-TO-DATE
    153. :Firebase:mergeReleaseShaders
    154. :Firebase:compileReleaseShaders
    155. :Firebase:generateReleaseAssets
    156. :Firebase:packageReleaseAssets
    157. :mergeReleaseAssets
    158. :transformClassesWithDexBuilderForRelease
    159. C:\Users\Michael Joubert\Documents\Necrorok\Temp\gradleOut\libs\com.squareup.okhttp3.okhttp-3.12.1.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
    160. C:\Users\Michael Joubert\.gradle\caches\transforms-1\files-1.1\com.google.android.gms.play-services-auth-16.0.1.aar\77f5fa9127dce19ff9271b0c95e73323\jars\classes.jar: D8: Interface `android.support.v4.app.LoaderManager$LoaderCallbacks` not found. It's needed to make sure desugaring of `com.google.android.gms.auth.api.signin.internal.SignInHubActivity$zzc` is correct. Desugaring will assume that this interface has no default method.
    161. C:\Users\Michael Joubert\.gradle\caches\transforms-1\files-1.1\com.google.android.gms.play-services-auth-16.0.1.aar\77f5fa9127dce19ff9271b0c95e73323\jars\classes.jar: D8: Type `android.support.v4.app.FragmentActivity` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.auth.api.signin.internal.SignInHubActivity.onCreate(android.os.Bundle)`
    162. :transformClassesWithDexBuilderForRelease FAILED
    163. 34 actionable tasks: 24 executed, 10 up-to-date
    164. ]
    165. exit code: 1
    166. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    167. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    168. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    169. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    170. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    171. Rethrow as GradleInvokationException: Gradle build failed
    172. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    173. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    174. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    175. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Error #2:
    Code (CSharp):
    1. Build completed with a result of 'Failed'
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Error #3:
    Code (CSharp):
    1. UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    2.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00234] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190
    3.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:96
    4. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    5.  
    Don't think #2 & 3 explain much about the error themselves, but I'm putting them in there just in case. ;)
     
    Last edited: Sep 14, 2019