Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandoche/0109849ef96c87bba8f436c58d342039 to your computer and use it in GitHub Desktop.
Save sandoche/0109849ef96c87bba8f436c58d342039 to your computer and use it in GitHub Desktop.
How to install firebase analytics in Godot

How to install firebase analytics in Godot

I wrote this guide about how to install firebase analytics in godot because I struggled and it may be useful for the future me and others.

1. Install NativeLib Addon

This guide explains how to install the nativelib Addon: https://drmoriarty.github.io/nativelib/guide/gui-usage.html#installation

In short:

  1. In the top bar of Godot click on AssetLib next to 2D, 3D, Script
  2. Look for NativeLib and install it
  3. Go to Project Settings > Plugins and make sure both NativeLib and NativeLib export plugin are both installed

2. Install Firebase Analytics

  1. In the top bar of Godot click on NativeLib next to 2D, 3D, Script, AssetLib
  2. Then activate the platform you want to add your plugins for (for example android and iOS)
  3. Then look for your plugin and click install and wait a bit until it installs

3. Load the Firebase config files from the firebase website

  • For iOS put the GoogleService-Info.plist in addons/nativelib-export/iOS
  • For Android put the google-services.json in android/build

4. Activate the plugin in the export

  1. Go to Project > Export
  2. Click on your export (like the android)
  3. Go to the Plugins section and activate Firebase Analytics
  4. You will be asked to activate Use Custom Build do so

5. Edit gradle.build

Follow what google says here: https://firebase.google.com/docs/android/setup#add-config-file

Basically add those lines commented here:

buildscript {

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
  }

  dependencies {
    // ...

    // Add the following line:
    classpath 'com.google.gms:google-services:4.3.10'  // Google Services plugin
  }
}

apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services'  // Google Services plugin

android {
  // ...
}

allprojects {
  // ...

  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
    // ...
  }
}

6. Use the plugin that is autoloaded

Follow the official doc here about how to use in your code: https://github.com/DrMoriarty/nativelib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment